package cn.fl.capital.controller;

import cmm.comm.facade.framework.api.ISysCdMapApiService;
import cmm.comm.facade.framework.api.ISysDictionaryApiService;
import cmm.comm.facade.framework.condition.SysCdMapDQueryCondition;
import cmm.comm.facade.framework.dto.SysCdMapDDTO;
import cmm.comm.facade.framework.dto.SysDictionaryDTO;
import cmm.mid.core.framework.dto.DataResultDTO;
import cmm.mid.core.framework.dto.tripartite.CreditDTO;
import cmm.mid.core.framework.page.DataResultVO;
import cmm.mid.core.framework.page.KeyValueVO;
import cmm.web.core.framework.controller.BaseController;
import cn.cmm.base.framework.constant.BaseConstant;
import cn.cmm.base.framework.constant.BaseExceptionConstant;
import cn.cmm.base.framework.exception.BaseException;
import cn.cmm.base.framework.logger.eum.LogExceptionEnum;
import cn.cmm.base.framework.utils.*;
import cn.cmm.cache.framework.service.ICacheService;
import cn.fl.audit.service.IAudReturnVisitService;
import cn.fl.audit.vo.AudReturnVisitVO;
import cn.fl.capital.api.ICapPayFlowApiService;
import cn.fl.capital.condition.CapPayInfoQueryCondition;
import cn.fl.capital.condition.CapPayeeInfoQueryCondition;
import cn.fl.capital.constant.CapPayeeInfoConstant;
import cn.fl.capital.constant.CapitalConstant;
import cn.fl.capital.dto.CapPayeeInfoDTO;
import cn.fl.capital.service.ICapPayInfoService;
import cn.fl.capital.service.ICapPayeeInfoApiService;
import cn.fl.capital.service.ICapPayeeInfoService;
import cn.fl.capital.vo.CapPayInfoVO;
import cn.fl.capital.vo.CapPayMaterialVo;
import cn.fl.capital.vo.CapPayeeInfoVO;
import cn.fl.commons.result.ResponseData;
import cn.fl.customer.service.ICstBscInfoService;
import cn.fl.customer.service.ICstCorpTeamService;
import cn.fl.customer.vo.CstBscInfoVO;
import cn.fl.customer.vo.CstCorpBscInfoVO;
import cn.fl.customer.vo.CstCorpTeamVO;
import cn.fl.customer.vo.CstNpBscInfoVO;
import cn.fl.datacheck.dto.RuleEngineDataCheckDTO;
import cn.fl.deviceinfo.api.IDeviceInfoApiService;
import cn.fl.enums.InsAccResEnum;
import cn.fl.framework.base.constant.WebBaseConstant;
import cn.fl.framework.base.context.CurrentThreadContext;
import cn.fl.framework.constant.DictionaryConstant;
import cn.fl.index.api.IPrjPlcyIndexApiService;
import cn.fl.index.constant.LcvCdsConstant;
import cn.fl.index.dto.LcvCdsResDTO;
import cn.fl.inscare.service.IInsApplicationStagingService;
import cn.fl.inscare.vo.InsApplicationVO;
import cn.fl.preloan.condition.expatriate.ExpBizManRecQueryCondition;
import cn.fl.preloan.dto.expatriate.ExpBizManRecDTO;
import cn.fl.preloan.enums.LogBusinessTypeEnum;
import cn.fl.preloan.expatriate.IExpBizManRecApiService;
import cn.fl.product.service.ISplBankService;
import cn.fl.project.api.IPrjBscExtApiService;
import cn.fl.project.api.IPrjPaySchMYqApiService;
import cn.fl.project.condition.*;
import cn.fl.project.constant.*;
import cn.fl.project.dto.PrjBscExtDTO;
import cn.fl.project.dto.PrjBscInfoDTO;
import cn.fl.project.service.*;
import cn.fl.project.transform.PrjBscInfoVOTransform;
import cn.fl.project.transform.PrjPrdPaySchMVOTransform;
import cn.fl.project.vo.*;
import cn.fl.ref.fribaseinfo.service.IFriBaseInfoService;
import cn.fl.ref.fribaseinfo.vo.FriBaseInfoVO;
import cn.fl.risk.service.IRskCstSignLogService;
import cn.fl.system.constant.SysLogConstant;
import cn.fl.system.service.ISysInsTabCfgService;
import cn.fl.system.service.ISysRegionService;
import cn.fl.system.service.ISysUsrService;
import cn.fl.system.vo.SysInsTabCfgVO;
import cn.fl.system.vo.SysRegionVO;
import cn.fl.system.vo.SysUsrVO;
import com.alibaba.fastjson.JSON;
import com.alibaba.fastjson.JSONObject;
import com.lionbridge.log.ext.ExtSlf4jLogger;
import com.lionbridge.log.ext.ExtSlf4jLoggerBuilder;
import com.lionbridge.log.ext.LogTypeEnum;
import fl.customer.facade.customer.api.ICustomerQueryApiService;
import fl.customer.facade.customer.condition.CstBankQueryCondition;
import fl.customer.facade.customer.condition.CstCorpTeamQueryCondition;
import fl.customer.facade.customer.constant.CustomerConstant;
import fl.customer.facade.customer.dto.CstBankDTO;
import fl.flow.facade.flow.constant.FlowConstant;
import fl.flow.facade.flow.dto.FlowCompleteParamsDTO;
import fl.inf.facade.api.IBFSApiService;
import fl.inf.facade.api.ITransLogApi;
import fl.inf.facade.condition.InfTransLogQueryCondition;
import fl.inf.facade.constant.InterfaceConstants;
import fl.inf.facade.dto.InfBfsPayDTO;
import fl.inf.facade.dto.InfTransLogDTO;
import fl.inf.facade.dto.MessageDTO;
import fl.ref.fribaseinfo.condition.FriBaseInfoQueryCondition;
import fl.ref.fribaseinfo.constant.FriBaseInfoConstant;
import fl.ref.fribaseinfo.service.IBankAccInfoApiService;
import fl.spl.facade.spl.api.ISplHRiskWarnRecApiService;
import fl.spl.facade.spl.condition.SplHRiskWarnRecQC;
import fl.spl.facade.spl.dto.SplHRiskWarnRecDTO;
import fl.tripartite.facade.api.ITripartiteApi;
import fl.webank.facade.api.IWeBankApi;
import lombok.extern.slf4j.Slf4j;
import org.apache.commons.collections.MapUtils;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.ResponseBody;
import org.springframework.web.servlet.ModelAndView;
import pam.ccbank.facade.api.ICCBankApiService;
import pam.ccbank.facade.dto.PrjPaySchMDTO;

import javax.annotation.Resource;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import javax.servlet.http.HttpSession;
import java.text.DecimalFormat;
import java.text.SimpleDateFormat;
import java.util.*;
import java.util.stream.Collectors;
import java.util.stream.Stream;

/**
 * 放款流程 控制层
 * @author yaoxiurong
 *
 */
@Slf4j
@Controller
@RequestMapping("/capPay/flow")
public class CapPayFlowController extends BaseController {
	
	private static final Logger logger = LoggerFactory.getLogger(CapPayFlowController.class);

	private static ExtSlf4jLogger extSlf4jLogger = ExtSlf4jLoggerBuilder.create()
			.setBusinessType(LogBusinessTypeEnum.PRE_LOAN.getCode())
			.setSubBusinessType(LogBusinessTypeEnum.FLOW.getCode())
			.setLogType(LogTypeEnum.BUSINESS)
			.setLogger(log).build();

	/**
	 * 付款信息服务
	 */
	@Autowired
	private ICapPayInfoService capPayInfoService;
	
	/**
	 * 收款方服务
	 */
	@Autowired
	private ICapPayeeInfoService capPayeeInfoService;
	
	/**
	 * 客户查询服务
	 */
	@Autowired
	private ICustomerQueryApiService customerQueryApiService;

	@Autowired
	private IFriBaseInfoService friBaseInfoService;//融资机构基础信息表

	/**
	 * 资金系统服务
	 */
	@Autowired
	private IBFSApiService bFSApiService;
	
	/**
	 * 上牌
	 */
	@Autowired
	private IPrjPrdLicInfoService prjPrdLicInfoService;
	
	/**
	 * 抵押
	 */
	@Autowired
	private IPrjPrdMtgService prjPrdMtgService;
	
	/**
	 * 项目信息服务
	 */
	@Autowired
	private IPrjBscInfoService prjBscInfoService;
	
	/**
	 * 收款方API服务
	 */
	@Autowired
	private ICapPayeeInfoApiService capPayeeInfoApiService;
	
	/**
	 * 项目合同服务
	 */
	@Autowired
	private IPrjContService prjContService;
	
	@Autowired
	private IPrjPrdPaySchMService prjPrdPaySchMService;
	
	@Autowired
	private IPrjSplBankAccRService prjSplBankAccRService;
	
	@Autowired
	private ISplBankService splBankService;
	
	@Autowired
	private ITransLogApi transLogApi;
	
	@Autowired
	private ITripartiteApi tripartiteApi;
	
	@Autowired
	private IPrjPrdBscInfoService prjPrdBscInfoService;
	
	@Autowired
	private IPrjPrdPaySchMApiService prjPrdPaySchMApiService;
	
	@Autowired
	private IPrjPrdDtlService prjPrdDtlService;
	
	@Autowired
	private IProjectApiService projectApiService;
	@Autowired
	private IInsApplicationStagingService insApplicationStagingService;
	@Autowired
	private ICstBscInfoService cstBscInfoService;//客户基础信息表
	@Autowired
	private IAudReturnVisitService audReturnVisitService;//客户基础信息表
	@Autowired
	private ISysDictionaryApiService sysDictionaryApiService;

	@Autowired
	private ICacheService cacheService;
	
	@Autowired
	private IPrjBscExtApiService prjBscExtApiService;

	@Autowired
	private IRskCstSignLogService rskCstSignLogService;

	@Autowired
	private IPrjPrdVehInfoService prjPrdVehInfoService;

	@Autowired
    private ISplHRiskWarnRecApiService splHRiskWarnRecApiService;

	@Autowired
	private IPrjPaySchMYqService prjPaySchMYqService;

	@Autowired
	private IPrjPaySchMYqApiService prjPaySchMYqApiService;
	@Autowired
	private IWeBankApi weBankApi;

	@Autowired
    private ICCBankApiService cCBankApiService;

	@Autowired
	private ICstCorpTeamService cstCorpTeamService;

	@Autowired
	private ISysCdMapApiService sysCdMapApiService;

	@Autowired
	private ISysRegionService sysRegionService;

	@Autowired
	private IPrjCstAccInfoService prjCstAccInfoService;

	@Autowired
	IDeviceInfoApiService deviceInfoApiService;

	@Autowired
	private ISysInsTabCfgService sysInsTabCfgService;

	@Autowired
	private IPrjPlcyIndexApiService prjPlcyIndexApiService;

	@Autowired
	private ICapPayFlowApiService capPayFlowApiService;

	@Autowired
	private IBankAccInfoApiService bankAccInfoApiService;

	@Autowired
	private ISysUsrService sysUsrService;

	@Autowired
	private IExpBizManRecApiService expBizManRecApiService;

	@Autowired
	private IPrjQuatPrpsService prjQuatPrpsService;

	/**
	 * 到流程附加信息页面
	 */
	@RequestMapping(value = "/toAdditionalInfoPageV1.do", method = { RequestMethod.GET, RequestMethod.POST })
	public ModelAndView toAdditionalInfoPageV1(HttpServletRequest request, HttpServletResponse response) {
		ModelAndView view = new ModelAndView("capital/flowAdditionalInfo/payFlowAdditionalPage");
		try {
			String isAuditNode = request.getParameter("isAuditNode");//是否信审节点标识
			String taskNm = request.getParameter("taskNm");//任务名称
			if (taskNm!=null&&(taskNm.equals("信审审核")||
					taskNm.contains("信审审核抵押")||
					taskNm.contains("信审审核上牌抵押"))) {
				isAuditNode="1";
			}

			String capPayId = request.getParameter("capPayId");//业务主键(付款信息ID)
			String proIntId = request.getParameter("processInstanceId");//流程实例ID
			String taskId = request.getParameter("taskId");//任务ID
			String taskDefKey = request.getParameter("taskDefKey");//任务KEY

			view.addObject("capPayId", capPayId);
			view.addObject("proIntId", proIntId);
			view.addObject("taskId", taskId);
			view.addObject("taskDefKey", taskDefKey);
			view.addObject("taskNm", taskNm);

			view.addObject("isAuditNode", isAuditNode);

			if (taskNm!=null && (taskNm.contains("呈报人") || taskNm.equals("信审审核合同"))){
				view.addObject("operateInsPlc", "1"); //1 允许修改、删除保单信息
			}
			//轻卡、重卡优车、三方资管城配、新能源、重卡城配、重卡特殊等部分信审审核、信审员审核、信审上牌抵押节点
			if (StringUtils.isNotBlank(taskDefKey) && (taskDefKey.equals("FLOW_00000014_002_002_002") || taskDefKey.equals("FLOW_00000014_007_003_002")
			|| taskDefKey.equals("FLOW_00000014_007_004_002") || taskDefKey.equals("FLOW_0000_002_006_011") || taskDefKey.equals("FLOW_0000_002_003_011")
			|| taskDefKey.equals("FLOW_00000001_001_004_016") || taskDefKey.equals("FLOW_00000001_001_004_001") || taskDefKey.equals("FLOW_00000013_001_003_010")
			|| taskDefKey.equals("FLOW_00000013_001_002_001") || taskDefKey.equals("FLOW_00000013_001_002_016") || taskDefKey.equals("FLOW_00000001_001_001_016")
			|| taskDefKey.equals("FLOW_00000001_001_001_001") || taskDefKey.equals("FLOW_00000001_008_001_016") || taskDefKey.equals("FLOW_00000001_008_001_010"))){
				view.addObject("operateInsPlc", "1"); //1 允许修改、删除保单信息
			}

			if(StringUtils.isEmpty(capPayId))throw new BaseException(BaseExceptionConstant.BASE_EXCEPTION_CODE_600, "流程中业务主键为空.");
			//查询付款信息
			BaseLogUtils.info(logger, "toAdditionalInfoPage", "===查询付款信息Start===capPayId:"+capPayId, CurrentThreadContext.getCurrentUserName());
			CapPayInfoVO capPayInfoVO=this.capPayInfoService.selectById(Long.valueOf(capPayId));
			BaseLogUtils.info(logger, "toAdditionalInfoPage", "===查询付款信息End===capPayId:"+capPayId+",capPayInfoVO:"+JSON.toJSONString(capPayInfoVO), CurrentThreadContext.getCurrentUserName());
			
			BaseLogUtils.info(logger, "toAdditionalInfoPage", "===查询租赁物数量、历史付款次数、上传资料数量Start===capPayId:"+capPayId+",capPayInfoVO:"+JSON.toJSONString(capPayInfoVO), CurrentThreadContext.getCurrentUserName());
			//Tab头 查询付款信息中租赁物数量、历史付款次数、上传资料数量
			capPayInfoVO=this.capPayInfoService.getPayInfoCount(capPayInfoVO);
			BaseLogUtils.info(logger, "toAdditionalInfoPage", "===查询租赁物数量、历史付款次数、上传资料数量End===capPayId:"+capPayId+",capPayInfoVO:"+JSON.toJSONString(capPayInfoVO), CurrentThreadContext.getCurrentUserName());
			view.addObject("capPayInfoVO",capPayInfoVO);
			//查询代扣卡验证状态
			String audStsCdNm = "";
			CstBankQueryCondition cstBankQC = new CstBankQueryCondition();
			List<Long> cstIdList = new ArrayList<Long>();
			cstIdList.add(capPayInfoVO.getCstId());
			cstBankQC.setCstIdList(cstIdList);
			cstBankQC.setIsDeduct(BaseConstant.IS_YESNO_YES);
			cstBankQC.setSysCd(CurrentThreadContext.getCurrentSysCd());
			cstBankQC.setOrgCd(CurrentThreadContext.getCurrentOrgCd());
			
			BaseLogUtils.info(logger, "toAdditionalInfoPage", "===根据查询条件获取客户帐号信息Start===cstId:"+capPayInfoVO.getCstId()+",cstBankQC:"+JSON.toJSONString(cstBankQC), CurrentThreadContext.getCurrentUserName());
			List<CstBankDTO> list = this.customerQueryApiService.searchCstBankWithCstInfoList(cstBankQC);
			BaseLogUtils.info(logger, "toAdditionalInfoPage", "===根据查询条件获取客户帐号信息End===cstId:"+capPayInfoVO.getCstId()+",list:"+JSON.toJSONString(list), CurrentThreadContext.getCurrentUserName());
			if(CollectionUtils.isNotEmpty(list)){
				CstBankDTO cstBankDTO = list.get(0);
				if(null!=cstBankDTO){
					audStsCdNm = cstBankDTO.getAudStsCdNm();
				}
			}
			view.addObject("audStsCdNm", audStsCdNm);
			
			
			//收款方类型
			List<KeyValueVO> payeeTypCdList = this.capPayInfoService.getPayeeTypCdList();
			view.addObject("payeeTypCdList",JSON.toJSONString(payeeTypCdList));
			//款项
			/*List<KeyValueVO> fundTypCdList=this.capPayInfoService.getFundTypCdList();
			view.addObject("fundTypCdList",JSON.toJSONString(fundTypCdList));*/
			//付款方式
			List<KeyValueVO> payWayCdList=this.capPayInfoService.getPayWayCdList();
			view.addObject("payWayCdList",JSON.toJSONString(payWayCdList));
			//账户类型
			List<KeyValueVO> bkAccTypCdList=this.capPayInfoService.getBkAccTypCdList();
			view.addObject("bkAccTypCdList",JSON.toJSONString(bkAccTypCdList));
			//是否
			List<KeyValueVO> yesOrNOList = this.capPayInfoService.searchYesOrNOList();
			view.addObject("yesOrNOList", yesOrNOList);
			
			//查询收款方信息
			CapPayeeInfoQueryCondition payeeInfoQueryCondition=new CapPayeeInfoQueryCondition();
			payeeInfoQueryCondition.setPayId(Long.valueOf(capPayId));
			BaseLogUtils.info(logger, "toAdditionalInfoPage", "===查询收款方信息Start===capPayId:"+capPayId, CurrentThreadContext.getCurrentUserName());
			List<CapPayeeInfoVO> payeeVOList= capPayeeInfoService.searchList(payeeInfoQueryCondition);
			BaseLogUtils.info(logger, "toAdditionalInfoPage", "===查询收款方信息End===capPayId:"+capPayId+",payeeVOList:"+JSON.toJSONString(payeeVOList), CurrentThreadContext.getCurrentUserName());
			if(CollectionUtils.isNotEmpty(payeeVOList)){//现只有一个收款方
			    view.addObject("capPayeeInfoVO",payeeVOList.get(0));
			    CapPayeeInfoVO capPayeeInfoVO = payeeVOList.get(0); 
			    //先查询
			    BaseLogUtils.info(logger, "toAdditionalInfoPage", "===根据放款单流水号查询支付单信息Start===capPayeeId:"+capPayeeInfoVO.getId(), CurrentThreadContext.getCurrentUserName());
				InfBfsPayDTO bfsPayDTO = this.bFSApiService.selectByFlsNum(Long.valueOf(capPayeeInfoVO.getId()));
				BaseLogUtils.info(logger, "toAdditionalInfoPage", "===根据放款单流水号查询支付单信息End===capPayeeId:"+capPayeeInfoVO.getId()+",bfsPayDTO:"+JSON.toJSONString(bfsPayDTO), CurrentThreadContext.getCurrentUserName());
				//存在且状态不是发送失败也不是付款失败  则说明网银已经推送 页面控制付款方式不可修改
				if(null!=bfsPayDTO 
						&& !InterfaceConstants.BfsPayStatus.payFailure.key().equals(bfsPayDTO.getStatus())
						&& !InterfaceConstants.BfsPayStatus.sendFailure.key().equals(bfsPayDTO.getStatus())){
					view.addObject("isAllowMdfPayTypCd", "0");
				}
			}
			
			//接收流程定义URL 传过来的控制参数
			String hjzxFlag = request.getParameter("hjzxFlag");//呼叫中心:编辑是否团单:hjzxFlag 放款合同意见
			if(StringUtils.isEmpty(hjzxFlag)){
				hjzxFlag = "0";
			}
			String ctrlKey = request.getParameter("ctrlKey");//控制放款资料页签的操作 "3":不可操作  "2":验证放款资料  "1":上传/删除
			if(StringUtils.isEmpty(ctrlKey)){
				ctrlKey = "3";
			}
			String xsFlag = request.getParameter("xsFlag");//信审审核 放款抵押意见
			if(StringUtils.isEmpty(xsFlag)){
				xsFlag = "0";
			}
			String kjshFlag = request.getParameter("kjshFlag");//会计审核:核算实际付款金额(付款方)kjshFlag
			if(StringUtils.isEmpty(kjshFlag)){
				kjshFlag = "0";
			}
			String zjlFlag = request.getParameter("zjlFlag");//呈报人:可编辑收款方账号:zjlFlag=1(收款方)
			if(StringUtils.isEmpty(zjlFlag)){
				zjlFlag = "0";
			}
			String btnFlag = request.getParameter("btnFlag");//保存按钮显示 btnFlag=1
			if(StringUtils.isEmpty(btnFlag)){
				btnFlag = "0";
			}
			String zjbFlag = request.getParameter("zjbFlag");//资金部:可编辑付款方式:zjbFlag=1(收款方)
			if(StringUtils.isEmpty(zjbFlag)){
				zjbFlag = "0";
			}
			String cnFlag = request.getParameter("cnFlag"); //出纳:可编辑时间,金额:cnFlag=1(非网银)
			if(StringUtils.isEmpty(cnFlag)){
				cnFlag = "0";
			}
			String spFlag = request.getParameter("spFlag"); //上牌
			if(StringUtils.isEmpty(spFlag)){
				spFlag = "0";
			}
			String isExistSp = "";
			String spState = "0";
			Long prjPrdDtlId = capPayInfoVO.getPrjPrdDtlId();
			if(StringUtils.isNotEmpty(prjPrdDtlId)){
				//查询上牌信息
				BaseLogUtils.info(logger, "toAdditionalInfoPage", "===查询上牌信息Start===prjPrdDtlId:"+prjPrdDtlId, CurrentThreadContext.getCurrentUserName());
				PrjPrdLicInfoVO prjPrdLicInfoVO = this.prjPrdLicInfoService.selectById(prjPrdDtlId);
				BaseLogUtils.info(logger, "toAdditionalInfoPage", "===查询上牌信息End===prjPrdDtlId:"+prjPrdDtlId+",prjPrdLicInfoVO:"+JSON.toJSONString(prjPrdLicInfoVO), CurrentThreadContext.getCurrentUserName());
				if(null==prjPrdLicInfoVO){
					isExistSp = "0";
				}else{
					isExistSp = "1";
				}
				if(null!=prjPrdLicInfoVO && FlowConstant.FLOW_CHECK_STATE_PASS.equals(prjPrdLicInfoVO.getAudStsCd())){
					spState = "1";
				}
			}
			view.addObject("spState", spState);
			view.addObject("isExistSp", isExistSp);

			//风险标记开始
			List<Long> prjPrdDtlIdList = new ArrayList<Long>();
			prjPrdDtlIdList.add(prjPrdDtlId);
			Map<String,String> result = this.rskCstSignLogService.searchRskResInfo(capPayInfoVO.getCstId(),Long.valueOf(capPayInfoVO.getPrjId()),prjPrdDtlIdList);
			if(MapUtils.isNotEmpty(result)){
				//客户风险标记
				view.addObject("rskCstSignDesc",result.get("rskCstSignDesc"));
				//设备风险标记
				view.addObject("rskProdSignDesc", result.get("rskProdSignDesc"));
				//担保人风险标记
				view.addObject("rskGuarSignDesc", result.get("rskGuarSignDesc"));
				//vin风险标记
				view.addObject("rskVinSignDesc",result.get("rskVinSignDesc"));
				//承租人手机号风险标记
				view.addObject("rskCstMpSignDesc", result.get("rskCstMpSignDesc"));
				//挂靠公司风险标记
				view.addObject("rskLnkSignDesc", result.get("rskLnkSignDesc"));
				//供应商风险标记
				view.addObject("rskSplSignDesc", result.get("rskSplSignDesc"));
			}else{
				//客户风险标记
				view.addObject("rskCstSignDesc","");
				//设备风险标记
				view.addObject("rskProdSignDesc", "");
				//担保人风险标记
				view.addObject("rskGuarSignDesc", "");
				//vin风险标记
				view.addObject("rskVinSignDesc","");
				//承租人手机号风险标记
				view.addObject("rskCstMpSignDesc", "");
				//挂靠公司风险标记
				view.addObject("rskLnkSignDesc", "");
				//供应商风险标记
				view.addObject("rskSplSignDesc", "");
			}
			String dyFlag = request.getParameter("dyFlag"); //抵押
			if(StringUtils.isNotEmpty(dyFlag)){
				dyFlag = dyFlag.replace("\'", "");
			}else{
				dyFlag = "0";
			}
			//2017-3-31 String escFlag = "0";
			String escFlag = "1";
			String isExistDy = "";
			String dyState = "0";
			if(StringUtils.isNotEmpty(prjPrdDtlId)){
				//查询抵押信息
				BaseLogUtils.info(logger, "toAdditionalInfoPage", "===查询抵押信息Start===prjPrdDtlId:"+prjPrdDtlId, CurrentThreadContext.getCurrentUserName());
				PrjPrdMtgVO prjPrdMtgVO = this.prjPrdMtgService.selectById(prjPrdDtlId);
				BaseLogUtils.info(logger, "toAdditionalInfoPage", "===查询抵押信息End===prjPrdDtlId:"+prjPrdDtlId+",prjPrdMtgVO:"+JSON.toJSONString(prjPrdMtgVO), CurrentThreadContext.getCurrentUserName());
				if(null==prjPrdMtgVO){
					isExistDy = "0";
				}else{
					isExistDy = "1";
				}
				if(null!=prjPrdMtgVO && PrjPrdMtgConstant.CODE_GUAR_STS_CD_MTG.equals(prjPrdMtgVO.getGuarStsCd())){
					dyState = "1";
				}
			}
			view.addObject("dyState", dyState);
			/*2017-3-31 Long prjId = capPayInfoVO.getPrjId();
			if(StringUtils.isNotEmpty(prjId)){
				PrjBscInfoVO prjBscInfoVO = this.prjBscInfoService.selectById(prjId);
				if(null!=prjBscInfoVO && PrjBscInfoConstant.PRJ_TYP_CD_ESC.equals(prjBscInfoVO.getPrjTypCd())){
					if(null!=prjBscInfoVO){
			    		escFlag = "1";
			        	if(StringUtils.isNotEmpty(prjPrdDtlId)){
			        		//查询抵押信息
			        		PrjPrdMtgVO prjPrdMtgVO = this.prjPrdMtgService.selectById(prjPrdDtlId);
			        		if(null==prjPrdMtgVO){
			        			isExistDy = "0";
			        		}else{
			        			isExistDy = "1";
			        		}
			        	}
			    	}
				}
			}*/
			view.addObject("escFlag", escFlag);
			view.addObject("dyFlag", dyFlag);
			view.addObject("isExistDy", isExistDy);
			
			view.addObject("btnFlag", btnFlag);
			view.addObject("hjzxFlag", hjzxFlag);
			view.addObject("kjshFlag", kjshFlag);
			view.addObject("zjlFlag", zjlFlag);
			view.addObject("zjbFlag", zjbFlag);
			view.addObject("cnFlag", cnFlag);
			view.addObject("xsFlag", xsFlag);
			view.addObject("spFlag", spFlag);
			view.addObject("ctrlKey", ctrlKey);
			
			String isCPCW = request.getParameter("isCPCW");
			view.addObject("isCPCW", isCPCW);
			String isNeedCallback = request.getParameter("isNeedCallback");
			view.addObject("isNeedCallback", isNeedCallback);
			String bhFlag = request.getParameter("bhFlag");//是否可以维护驳回意见
			view.addObject("bhFlag", bhFlag);
			
			String checkSp = request.getParameter("checkSp");//是否有验证上牌信息权限
			view.addObject("checkSp", checkSp);
			String checkDy = request.getParameter("checkDy");//是否有验证抵押信息权限
			view.addObject("checkDy", checkDy);
			
			//by YAOXIURONG 17-9-1
			String QZTX = request.getParameter("QZTX");//起租提醒节点标识
			view.addObject("QZTX", QZTX);
			
			//by YAOXIURONG 17-9-7
			String addReturnInfo = request.getParameter("addReturnInfo");//是否可以保存实付时间和金额(网银实际付款成功确没有回传时间和金额)
			view.addObject("addReturnInfo", addReturnInfo);
			
			String confirmPay = request.getParameter("confirmPay");//付款审核
			view.addObject("confirmPay", confirmPay);
		} catch (BaseException e) {
			BaseLogUtils.error(logger, "toAdditionalInfoPage", "===<toAdditionalInfoPage>跳转放款流程附加信息页面BASE异常===Detail:"+e.getMessage(), CurrentThreadContext.getCurrentUserName());
			e.printStackTrace();
		} catch (Exception e) {
			BaseLogUtils.error(logger, "toAdditionalInfoPage", "===<toAdditionalInfoPage>跳转放款流程附加信息页面异常===Detail:"+e.getMessage(), CurrentThreadContext.getCurrentUserName());
			e.printStackTrace();
		}
        
		return view;
	}
	
	private String getStatusNm(String status){
    	if(StringUtils.isNotEmpty(status)){
    		if(cmm.mid.core.framework.constant.tripartite.InterfaceConstants.TransStatus.unsent.key().equals(status)){
        		return cmm.mid.core.framework.constant.tripartite.InterfaceConstants.TransStatus.unsent.desc();
        	}else if(cmm.mid.core.framework.constant.tripartite.InterfaceConstants.TransStatus.failure.key().equals(status)){
        		return cmm.mid.core.framework.constant.tripartite.InterfaceConstants.TransStatus.failure.desc();
        	}else if(cmm.mid.core.framework.constant.tripartite.InterfaceConstants.TransStatus.success.key().equals(status)){
        		return cmm.mid.core.framework.constant.tripartite.InterfaceConstants.TransStatus.success.desc();
        	}else if("0".equals(status)){
        		return "等待处理";
        	}else if("1".equals(status)){
        		return "查询通过";
        	}else if("2".equals(status)){
        		return "查询不通过";
        	}else if("3".equals(status)){
        		return "放弃查询";
        	}else if("9".equals(status)){
        		return "未知错误，请联系系统管理员确认";
        	}else{
        		return "无";
        	}
    	}else{
    		return "无";
    	}
    }
	
	/**
	 * 到流程附加信息页面
	 * @param isGpsNode 是否为风控审批GPS节点，1：是 0：否
	 */
	@RequestMapping(value = "/toAdditionalInfoPage.do", method = { RequestMethod.GET, RequestMethod.POST })
	public ModelAndView toAdditionalInfoPage(HttpServletRequest request, HttpServletResponse response,@RequestParam(required = false,defaultValue = "0") String isGpsNode) {
		String sysCd = CurrentThreadContext.getCurrentSysCd(); 
		String orgCd = CurrentThreadContext.getCurrentOrgCd();
		String version = request.getParameter("version");//version:2 第二个版本页面处理逻辑
		if(StringUtils.isNotEmpty(version) && "2".equals(version)){
			ModelAndView view = new ModelAndView("capital/flowAdditionalInfo/payFlowAdditionalPageV2");
			try {
				String updInsLoan = request.getParameter("updInsLoan");//是否可修改外部机构放款
				String isAuditNode = request.getParameter("isAuditNode");//是否信审节点标识
				String EmergencyContact = request.getParameter("EmergencyContact");//紧急联系人标识
				String returnvisit = request.getParameter("returnvisit");//后续回访标识
				String capPayId = request.getParameter("capPayId");//业务主键(付款信息ID)
				String proIntId = request.getParameter("processInstanceId");//流程实例ID
				String taskId = request.getParameter("taskId");//任务ID
				String taskDefKey = request.getParameter("taskDefKey");//任务KEY
				String taskNm = request.getParameter("taskNm");//任务名称
				String procNm = request.getParameter("procNm");//流程名称
				String authNm = request.getParameter("authNm");//抵押权人修改标识
				String setLeaseData = request.getParameter("setLeaseData");//资方起租日是否显示
				if (taskNm!=null&&(taskNm.equals("信审审核")||
						taskNm.contains("信审审核抵押")||
						taskNm.contains("信审审核上牌抵押"))) {
					isAuditNode="1";
				}

				/**
				 * "信审遗留问题"字段修改标识（add by JL 20190819）
				 * [信审审核/信审审核上牌抵押/信审审核抵押/商务审批]节点均允许修改
				 */
				if (taskNm!=null && (taskNm.equals("信审审核") || taskNm.contains("信审审核上牌抵押") || taskNm.contains("信审审核抵押")
						 || taskNm.contains("商务审批") || taskNm.contains("商务审核"))) {
					view.addObject("mdf_AudRemainPro", "1"); //1 允许修改
				}

				/**
				 * 以下特定流程的节点，有维护抵押信息权限
				 * 重卡正常放款流程-上牌抵押FLOW_00000001_002_001_007
				 * 二手车正常放款流程-上牌抵押FLOW_0000_002_001_008
				 * 车抵贷线下正常放款流程-上牌抵押FLOW_0000_002_005_008
				 */
				if (("重卡正常放款流程".equals(procNm) &&"FLOW_00000001_002_001_007".equals(taskDefKey))
						|| ("二手车正常放款流程".equals(procNm) &&"FLOW_0000_002_001_008".equals(taskDefKey))
						|| ("车抵贷线下正常放款流程".equals(procNm) &&"FLOW_0000_002_005_008".equals(taskDefKey))) {
					view.addObject("canUpdateMtg", 1);
				}
				//为兼容老数据，资金部审核节点，设置updInsLoan=2
				Boolean isOld = false;
				if (StringUtils.isNotEmpty(taskDefKey) && ("FLOW_00000001_002_001_079".equals(taskDefKey)
						|| "FLOW_00000001_007_001_083".equals(taskDefKey) || "FLOW_00000001_007_002_081".equals(taskDefKey)
						|| "FLOW_00000001_001_001_090".equals(taskDefKey) || "FLOW_00000008_002_002_049".equals(taskDefKey)
						|| "FLOW_00000008_007_002_052".equals(taskDefKey))){
					updInsLoan = "2";
					isOld = true;
				}
				if (StringUtils.isEmpty(updInsLoan)) updInsLoan = "0";
					view.addObject("updInsLoan", updInsLoan);

				if (taskNm!=null && (taskNm.contains("呈报人") || taskNm.equals("信审审核合同"))){
					view.addObject("operateInsPlc", "1"); //1 允许修改、删除保单信息
				}
				//轻卡、重卡优车、三方资管城配、新能源、重卡城配、重卡特殊等部分信审审核、信审员审核、信审上牌抵押节点
				if (StringUtils.isNotBlank(taskDefKey) && (taskDefKey.equals("FLOW_00000014_002_002_002") || taskDefKey.equals("FLOW_00000014_007_003_002")
				|| taskDefKey.equals("FLOW_00000014_007_004_002") || taskDefKey.equals("FLOW_0000_002_006_011") || taskDefKey.equals("FLOW_0000_002_003_011")
				|| taskDefKey.equals("FLOW_00000001_001_004_016") || taskDefKey.equals("FLOW_00000001_001_004_001") || taskDefKey.equals("FLOW_00000013_001_003_010")
				|| taskDefKey.equals("FLOW_00000013_001_002_001") || taskDefKey.equals("FLOW_00000013_001_002_016") || taskDefKey.equals("FLOW_00000001_001_001_016")
				|| taskDefKey.equals("FLOW_00000001_001_001_001") || taskDefKey.equals("FLOW_00000001_008_001_016") || taskDefKey.equals("FLOW_00000001_008_001_010"))){
					view.addObject("operateInsPlc", "1"); //1 允许修改、删除保单信息
				}
				int guaraStatus = 1;//担保人操作按钮展示状态
				if (StringUtils.isNotBlank(taskDefKey)) {
					if (PrjBscInfoConstant.VERIFY_DBR_CAN_PUSH_FLOW_NO.contains(taskDefKey)){
						guaraStatus = 2;
					}
				}
				view.addObject("guaraStatus", guaraStatus);
				view.addObject("capPayId", capPayId);
				view.addObject("proIntId", proIntId);
				view.addObject("taskId", taskId);
				view.addObject("taskDefKey", taskDefKey);
				view.addObject("taskNm", taskNm);
				view.addObject("procNm", procNm);
				view.addObject("isAuditNode", isAuditNode);
				view.addObject("EmergencyContact", EmergencyContact);//紧急联系人标识
				view.addObject("returnvisit", returnvisit);//后续回访标识
				view.addObject("authNm", authNm);//抵押权人修改标识
				String mdfCntTypCd = request.getParameter("mdfCntTypCd");//是否可以修改合同签署方式  1:修改
				view.addObject("mdfCntTypCd", mdfCntTypCd);
				view.addObject("setLeaseData", setLeaseData);
				
				String mdfInsPlc = request.getParameter("mdfInsPlc");//是否可以编辑保单信息 1:可以编辑
				view.addObject("mdfInsPlc", mdfInsPlc);
				view.addObject("isGpsNode", isGpsNode);
                view.addObject("currentUsrId", CurrentThreadContext.getCurrentUserId());

                if(StringUtils.isEmpty(capPayId))throw new BaseException(BaseExceptionConstant.BASE_EXCEPTION_CODE_600, "流程中业务主键为空.");
				//查询付款信息
				BaseLogUtils.info(logger, "toAdditionalInfoPage", "===查询付款信息Start===capPayId:"+capPayId, CurrentThreadContext.getCurrentUserName());
				CapPayInfoVO capPayInfoVO=this.capPayInfoService.selectById(Long.valueOf(capPayId));
				BaseLogUtils.info(logger, "toAdditionalInfoPage", "===查询付款信息End===capPayId:"+capPayId+",capPayInfoVO:"+JSON.toJSONString(capPayInfoVO), CurrentThreadContext.getCurrentUserName());
				view.addObject("prjId", capPayInfoVO.getPrjId());//项目id
				view.addObject("loanInsCode",capPayInfoVO.getLoanInsCode());
				view.addObject("loanInsNm",capPayInfoVO.getLoanInsNm());
				view.addObject("isOutInsLoan",capPayInfoVO.getIsOutInsLoan());
				Date insLoanTm = capPayInfoVO.getInsLoanTm();
				SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd");
				DecimalFormat df = new DecimalFormat("######0.00");//格式化保留两位小数
				String dateStr = "";
				if (insLoanTm != null) {
					dateStr = sdf.format(insLoanTm);
				}
				view.addObject("insLoanTm",dateStr);
				if (StringUtils.isNotEmpty(capPayInfoVO.getInsLoanSum())) {
					capPayInfoVO.setInsLoanSums(df.format(DecimalUtils.convertFenToYuan(capPayInfoVO.getInsLoanSum())));
				}
				view.addObject("insLoanSum",capPayInfoVO.getInsLoanSums());

				FriBaseInfoQueryCondition friQc = new FriBaseInfoQueryCondition();
				friQc.setInsSts(FriBaseInfoConstant.FRI_BASE_INFO_INS_STS_PASS);
				friQc.setInsUseCd("3");
				friQc.setIsService(1);
				friQc.setSysCd(CurrentThreadContext.getCurrentSysCd());
				friQc.setOrgCd(CurrentThreadContext.getCurrentOrgCd());
				BaseLogUtils.newLogger("查询机构,friQc:{}", JSON.toJSONString(friQc)).info();
				List<FriBaseInfoVO> friBaseInfoVOList = this.friBaseInfoService.searchList(friQc);
				BaseLogUtils.newLogger("查询机构,friQc:{}", JSON.toJSONString(friBaseInfoVOList)).info();
				Map<String,String> map1 = new HashMap<>();
				if (CollectionUtils.isNotEmpty(friBaseInfoVOList)){
					friBaseInfoVOList.forEach( friBaseInfoVO -> {
						map1.put(friBaseInfoVO.getInsCode(),friBaseInfoVO.getIsOutPay());
						view.addObject("friBaseMap", JSON.toJSONString(map1));
					});
				}

				//资金部审核节点查询机构
				if(null != capPayInfoVO.getPrjId() && StringUtils.isNotEmpty(capPayInfoVO.getProcDefKey())){
					BaseLogUtils.newLogger("调用规则引擎查询可用机构，prjId:{},ProcDefKey:{}",capPayInfoVO.getPrjId(),capPayInfoVO.getProcDefKey()).info();
					DataResultDTO dataResultDTO = capPayFlowApiService.getPrjInsFlowMatchRule(capPayInfoVO.getPrjId(),capPayInfoVO.getProcDefKey());
					BaseLogUtils.newLogger("调用规则引擎查询可用机构End，dataResultDTO:{}",JSON.toJSONString(dataResultDTO)).info();
					if (null != dataResultDTO && null != dataResultDTO.getData() && dataResultDTO.getSuccess() == 1){
						List<FriBaseInfoVO> friBaseInfoVOS = new ArrayList();
						//解析结果
						JSONObject result = (JSONObject) dataResultDTO.getData();
						if (result != null) {
							JSONObject decisionResult = result.getJSONObject("decisionResult");
							if (decisionResult != null) {
								JSONObject param = decisionResult.getJSONObject("param");
								if (param != null) {
									JSONObject data = param.getJSONObject("data");
									if (data != null) {
										FriBaseInfoVO friBaseInfoVO = null;
										for (Map.Entry<String, Object> entry : data.entrySet()) {
											friBaseInfoVO = new FriBaseInfoVO();
											friBaseInfoVO.setInsCode(entry.getKey());
											friBaseInfoVO.setFundRasInsNm(entry.getValue().toString());
											friBaseInfoVOS.add(friBaseInfoVO);
										}
									}
								}
							}
						}
						if (isOld){
							BaseLogUtils.newLogger("老数据剔除平安佛山，friBaseInfoVOS：{}",JSON.toJSONString(friBaseInfoVOS)).info();
							friBaseInfoVOS.stream().filter(fri -> "pafsbank".equals(fri.getInsCode())).collect(Collectors.toList());
							BaseLogUtils.newLogger("老数据剔除平安佛山End，friBaseInfoVOS：{}",JSON.toJSONString(friBaseInfoVOS)).info();
						}
						view.addObject("friBaseList", friBaseInfoVOS);
					}
				}

				String paySchNoYq = "";
				Long paySchIdYq = null;
				if (StringUtils.isNotEmpty(capPayInfoVO.getPrjTypCd()) && "CDDYWYQ".equals(capPayInfoVO.getPrjTypCd())) {
					view.setViewName("/project/prjcddywyq/payFlowAdditionalYqPage");
					PrjPaySchMYqQC prjPaySchMYqQC = new PrjPaySchMYqQC();
					prjPaySchMYqQC.setPrjId(capPayInfoVO.getPrjId());
					prjPaySchMYqQC.setYqPaySchNo(capPayInfoVO.getPaySchNo());
					List<PrjPaySchMYqVO> prjPaySchMYqVOS = prjPaySchMYqService.searchList(prjPaySchMYqQC);
					BaseLogUtils.newLogger("付款信息查询YQ项目数据prjPaySchMYqVOS=" + JSONObject.toJSONString(prjPaySchMYqVOS)).info();
					if (CollectionUtils.isNotEmpty(prjPaySchMYqVOS) && prjPaySchMYqVOS.get(0) != null && prjPaySchMYqVOS.get(0).getPaySchNo() != null && prjPaySchMYqVOS.get(0).getPaySchId() != null) {
						try {
							paySchNoYq = prjPaySchMYqVOS.get(0).getPaySchNo();//原支付表号
							paySchIdYq = prjPaySchMYqVOS.get(0).getPaySchId();//原支付表id
							view.addObject("paySchNoYq", paySchNoYq);
							view.addObject("paySchIdYq", paySchIdYq);
							view.addObject("prjIdYq", prjPaySchMYqVOS.get(0).getyPrjId());
							view.addObject("prjPrdIdYq", prjPaySchMYqVOS.get(0).getPrjPrdId());
							PrjPrdBscInfoVO prjPrdBscInfoVO = prjPrdBscInfoService.selectById(prjPaySchMYqVOS.get(0).getPrjPrdId());
							BaseLogUtils.newLogger("付款信息查询YQ项目数据prjPrdBscInfoVO=" + JSONObject.toJSONString(prjPrdBscInfoVO)).info();
							if (prjPrdBscInfoVO != null) {
								view.addObject("prjPrdDtlIdYq", prjPrdBscInfoVO.getPrdDtlId());
							}
						} catch (Exception e) {
							BaseLogUtils.error(logger, "toAdditionalInfoPage", "toAdditionalInfoPage跳转放款流程附加信息页面异常"+ e);
						}
					}
				}
				view.addObject("prjPrdDtlId", capPayInfoVO.getPrjPrdDtlId());//项目产品明细id
				List<KeyValueVO> genderCdList = this.cstBscInfoService.searchGenderCdList();//性别
				List<KeyValueVO> rlCdList = this.prjBscInfoService.getRlCdList();//与承租人关系
				view.addObject("genderCdList", JSON.toJSONString(genderCdList));
				view.addObject("rlCdList", JSON.toJSONString(rlCdList));
				AudReturnVisitVO audReturnVisitVO = this.audReturnVisitService.selectByProjectIdAndProIntId(capPayInfoVO.getPrjId());
				if(null != audReturnVisitVO){
					view.addObject("visitId", audReturnVisitVO.getId());
				}
				PrjPrdMtgVO prdMtgVO = this.prjPrdMtgService.selectById(capPayInfoVO.getPrjPrdDtlId());
				if(null !=prdMtgVO){
					String pledgeeAuthNm = prdMtgVO.getPledgeeAuthNm();//抵押权人名称
					view.addObject("pledgeeAuthNm", pledgeeAuthNm);
				}
				//抵押权人名称数据字典查询
				List<KeyValueVO> pledgeeNmList = this.sysDictionaryApiService.getKvList(DictionaryConstant.CODE_PLEDGEE_NM, sysCd, orgCd);
				view.addObject("pledgeeNmList", pledgeeNmList);
				String saveDueDate = request.getParameter("saveDueDate");//是否可以设置(第一期)还款日
				if("1".equals(saveDueDate) && StringUtils.isNotEmpty(capPayInfoVO.getPrjPrdId())){
					//查询是否上装产品
					PrjPrdBscInfoVO prjPrdBscInfoVO = this.prjPrdBscInfoService.selectById(capPayInfoVO.getPrjPrdId());
					if(null!=prjPrdBscInfoVO && CarStyleConstant.PRD_TYP_8.equals(prjPrdBscInfoVO.getPrdTypCd())){
						saveDueDate = "0";
					}
				}

				//风险标记开始
				List<Long> prjPrdDtlIdList = new ArrayList<Long>();
				prjPrdDtlIdList.add(capPayInfoVO.getPrjPrdDtlId());
				Map<String,String> result = this.rskCstSignLogService.searchRskResInfo(capPayInfoVO.getCstId(),Long.valueOf(capPayInfoVO.getPrjId()),prjPrdDtlIdList);
				if(MapUtils.isNotEmpty(result)){
					//客户风险标记
					view.addObject("rskCstSignDesc",result.get("rskCstSignDesc"));
					//设备风险标记
					view.addObject("rskProdSignDesc", result.get("rskProdSignDesc"));
					//担保人风险标记
					view.addObject("rskGuarSignDesc", result.get("rskGuarSignDesc"));
					//vin风险标记
					view.addObject("rskVinSignDesc",result.get("rskVinSignDesc"));
					//承租人手机号风险标记
					view.addObject("rskCstMpSignDesc", result.get("rskCstMpSignDesc"));
					//挂靠公司风险标记
					view.addObject("rskLnkSignDesc", result.get("rskLnkSignDesc"));
					//供应商风险标记
					view.addObject("rskSplSignDesc", result.get("rskSplSignDesc"));
				}else{
					//客户风险标记
					view.addObject("rskCstSignDesc","");
					//设备风险标记
					view.addObject("rskProdSignDesc", "");
					//担保人风险标记
					view.addObject("rskGuarSignDesc", "");
					//vin风险标记
					view.addObject("rskVinSignDesc","");
					//承租人手机号风险标记
					view.addObject("rskCstMpSignDesc", "");
					//挂靠公司风险标记
					view.addObject("rskLnkSignDesc", "");
					//供应商风险标记
					view.addObject("rskSplSignDesc", "");
				}
				
				view.addObject("saveDueDate", saveDueDate);
				//查询第一期还款日
				PrjPrdPaySchMVO prdPaySchMVO = this.prjPrdPaySchMService.selectById(capPayInfoVO.getPaySchId());
				if(null!=prdPaySchMVO && null!=prdPaySchMVO.getFstRepayDt()){
					view.addObject("dueDate", DateUtils.formatDateToString(prdPaySchMVO.getFstRepayDt(), DateUtils.YYYY_MM_DD));
				}
				
				String saveOrgBizOpnCd = request.getParameter("saveOrgBizOpnCd");//是否可以编辑三方业务处理意见 1:可以编辑
				view.addObject("saveOrgBizOpnCd", saveOrgBizOpnCd);
				//三方业务处理意见
				List<KeyValueVO> orgBizOpnCdList = this.capPayInfoService.searchOrgBizOpnCdList();
				view.addObject("orgBizOpnCdList", orgBizOpnCdList);
				PrjBscExtDTO prjBscExtDTO = this.prjBscExtApiService.searchById(capPayInfoVO.getPrjId());
				if(null==prjBscExtDTO) prjBscExtDTO = new PrjBscExtDTO();
				view.addObject("prjBscExtDTO", prjBscExtDTO);

                Long projectId = capPayInfoVO.getPrjId();
                PrjBscInfoVO prjBscInfoVO = prjBscInfoService.selectById(projectId);
				if (PrjBscInfoConstant.CODE_BU_ORG_CD_ZK.equals(prjBscInfoVO.getBuOrgCd())) {
					if (PrjBscInfoConstant.PRJ_TYP_CD_DSFZGCP.equals(prjBscInfoVO.getPrjTypCd()) || PrjBscInfoConstant.PRJ_TYP_CD_DSFZGCT.equals(prjBscInfoVO.getPrjTypCd())
							|| PrjBscInfoConstant.PRJ_TYP_CD_CTYW.equals(prjBscInfoVO.getPrjTypCd()) || PrjBscInfoConstant.PRJ_TYP_CD_CPYW.equals(prjBscInfoVO.getPrjTypCd())) {
						view.addObject("gpsFlag", capPayInfoService.getGPSFlag(prjBscInfoVO));
					}
				}
				if (PrjBscInfoConstant.CODE_BU_ORG_CD_XNY.equals(prjBscInfoVO.getBuOrgCd())) {
					if (PrjBscInfoConstant.PRJ_TYP_CD_CPYW.equals(prjBscInfoVO.getPrjTypCd()) || PrjBscInfoConstant.PRJ_TYP_CD_ZCSS.equals(prjBscInfoVO.getPrjTypCd())) {
						view.addObject("gpsFlag", capPayInfoService.getGPSFlag(prjBscInfoVO));
						view.addObject("noPassAudCarNum", capPayInfoService.getNoPassAudCarNum(prjBscInfoVO));
                        view.addObject("noSplPassNum", capPayInfoService.getNoSplPassNum(capPayInfoVO.getSplId()));
					}
				}
				String assetCd = request.getParameter("assetCd");// 校验资方放款（人工）
				if(StringUtils.isNotEmpty(assetCd) && "1".equals(assetCd) && null!=prjBscInfoVO
						&& (PrjBscInfoConstant.PRJ_INS_CODE_JXBANK.equals(prjBscInfoVO.getInsCode()) || PrjBscInfoConstant.PRJ_INS_CODE_QDGHBANK.equals(prjBscInfoVO.getInsCode()))) {
					view.setViewName("capital/flowAdditionalInfo/payFlowAdditionalPageForJxbank");
					view.addObject("fundRasInsNm", prjBscInfoVO.getFundRasInsNm());
					if (PrjBscInfoConstant.PRJ_INS_CODE_QDGHBANK.equals(prjBscInfoVO.getInsCode())) {
						view.addObject("showZgPayInfo", true);
						//查询三方支付表
						PrjPrdPaySchMQueryCondition pppsmqc = new PrjPrdPaySchMQueryCondition();
						pppsmqc.setPrjId(prjBscInfoVO.getId());
						pppsmqc.setIsSqBiz(0);
						pppsmqc.setIsDel(0);
						pppsmqc.setPaySchTypCd(PrjPrdPaySchMConstant.PAY_SCH_TYP_CD_ZF);
						List<PrjPrdPaySchMVO> prjPrdPaySchMVOS = this.prjPrdPaySchMService.searchList(pppsmqc);
						BaseLogUtils.newWebLogger("查询三方支付表结果prjPrdPaySchMVOS" + JSON.toJSONString(prjPrdPaySchMVOS));
						if(CollectionUtils.isNotEmpty(prjPrdPaySchMVOS)){
							PrjPrdPaySchMVO prjPrdPaySchMVO = prjPrdPaySchMVOS.get(0);
							view.addObject("prjPrdPaySchMVO", prjPrdPaySchMVO);
							if (StringUtils.isNotEmpty(prjPrdPaySchMVO.getThdPayAmt())) {
								view.addObject("thdPayAmt", DecimalUtils.convertFenToYuan(prjPrdPaySchMVO.getThdPayAmt()));
							}
							if (null != prjPrdPaySchMVO.getThdPayDt()) {
								view.addObject("thdPayDt", DateUtils.formatDateToString(prjPrdPaySchMVO.getThdPayDt(), DateUtils.YYYY_MM_DDHHMM));
							}
							view.addObject("payerStsCd", prjPrdPaySchMVO.getPayerStsCd());
						}
					}
				}
				//系统判断方案审核结果
				if (prjBscInfoVO != null && prjBscInfoVO.getAuditInfo() != null){
					String auditInfo = prjBscInfoVO.getAuditInfo();
					if(StringUtils.isNotEmpty(auditInfo)){
						String replaceAll = auditInfo.replaceAll(">>", "</br>");
						view.addObject("auditInfo", replaceAll);
					}
				}

				// 轻卡放款审核提示信息
				if (PrjBscInfoConstant.CODE_BU_ORG_CD_QK.equals(prjBscInfoVO.getBuOrgCd())) {
					view.addObject("buOrgCd", prjBscInfoVO.getBuOrgCd());
					int guaraStatusLcv = 1;//担保人操作按钮展示状态
					if (StringUtils.isNotBlank(taskDefKey) && PrjBscInfoConstant.LIGHT_TRUCK_FLOW_CHECK_LIST.contains(taskDefKey)){
						if(null != prjBscInfoVO && PrjBscInfoConstant.CODE_BU_ORG_CD_QK.equals(prjBscInfoVO.getBuOrgCd())
								&& StringUtils.isNotEmpty(prjBscInfoVO.getPrjRem()) && PrjBscInfoConstant.LIGHT_TRUCK_FLOW_CHECK_VALUE.equals(prjBscInfoVO.getPrjRem())){
							view.addObject("lcvCarChange", "1"); //1 显示提示信息
						}
						String businessCode = PropertiesUtils.getProperty(LcvCdsConstant.CDS_LCV_BUSINESS_CODE_CAP);
						try {
							LcvCdsResDTO lcvCdsResDTO = prjPlcyIndexApiService.searchCdsResultForLcv(Long.valueOf(projectId), businessCode);
							if(null != lcvCdsResDTO){
								String notice = lcvCdsResDTO.getNotice();
								String replaceAll = notice.replaceAll(">>", "</br>");
								view.addObject("auditInfo", replaceAll);
							}
						}catch (Exception e){
							BaseLogUtils.newLogger("toAdditionalInfoPage cap searchCdsResultForLcv" + e.getMessage()).setKeys("searchCdsResultForLcv").info();
							view.addObject("auditInfo", "--");
						}
						guaraStatusLcv = 3;
					}
					view.addObject("guaraStatusLcv", guaraStatusLcv);
				}
				//是否展示资方放款结果页面--0不展示 1展示
				String isShowLoanTab = "0";
				if (PrjBscInfoConstant.PRJ_INS_CODE_CCBANK.equals(prjBscInfoVO.getInsCode())
						|| ((prjBscInfoVO.getIsInsBiz()==null || (null!=prjBscInfoVO.getIsInsBiz()
						&& prjBscInfoVO.getIsInsBiz().intValue() == BaseConstant.IS_YESNO_NO))
						&& PrjBscInfoConstant.PRJ_INS_CODE_CCBANK.equals(prjBscExtDTO.getInsCode()))){
					isShowLoanTab = "1";
				}
				view.addObject("isShowLoanTab",isShowLoanTab);

				//是否展示银行信息采集：所属机构为建行 ccbanktb时，当前合同号下其余支付表号放款状态都不是“未申请”或者“放款失败”的时候，放款申请显示银行信息采集标签页
				String isShowAccTab = "0";
				if (PrjBscInfoConstant.PRJ_INS_CODE_CCBANKTB.equals(prjBscInfoVO.getInsCode())) {
					isShowAccTab = "1";
					CapPayInfoQueryCondition queryCondition = new CapPayInfoQueryCondition();
					queryCondition.setContNo(prjBscInfoVO.getLsCntNo());
					queryCondition.setExcludeId(Long.valueOf(capPayId));
					queryCondition.setIsDel(0);
					List<CapPayInfoVO> capPayInfoVOS = capPayInfoService.searchList(queryCondition);
					BaseLogUtils.newWebLogger("查询付款数据：" + JSON.toJSONString(capPayInfoVOS)).info();
					for (CapPayInfoVO payInfoVO : capPayInfoVOS) {
						if (CapitalConstant.CODE_CAP_PAY_STS_CD_1.equals(payInfoVO.getPayStsCd())
								|| CapitalConstant.CODE_CAP_PAY_STS_CD_4.equals(payInfoVO.getPayStsCd())){
							isShowAccTab = "0";
						}
					}
				}
				view.addObject("isShowAccTab",isShowAccTab);

				//三方资管查询征信结果
				try {
					view.addObject("cntTypCd", prjBscInfoVO.getCntTypCd());
					String insCode = "";//三方机构标识
					if(StringUtils.isNotEmpty(prjBscInfoVO.getInsCode())){
						insCode = prjBscInfoVO.getInsCode();
					}
					view.addObject("insCode", insCode);
					view.addObject("prjTypCd", prjBscInfoVO.getPrjTypCd());
					view.addObject("isInsBiz", prjBscInfoVO.getIsInsBiz());

					if(null!=prjBscInfoVO && StringUtils.isNotEmpty(prjBscInfoVO.getPrjTypCd()) && null!=prjBscInfoVO.getFundRasInsId()){

						//REQ-3756 36资管机构路由 by yaoxiurong 作废第三方资管城配,第三方资管传统 新增字段IS_INS_BIZ标识是否资管业务
						if((null!=prjBscInfoVO.getIsInsBiz() && BaseConstant.IS_YESNO_YES==prjBscInfoVO.getIsInsBiz().intValue())){
							if(!PrjBscInfoConstant.PRJ_INS_CODE_SN.equals(prjBscInfoVO.getInsCode())){
								//查询征信发送状态
								InfTransLogQueryCondition itlQC = new InfTransLogQueryCondition();
								//浙商查询条件特殊处理
								if(PrjBscInfoConstant.PRJ_INS_CODE_ZS.equals(prjBscInfoVO.getInsCode())){
									itlQC.setAction(cmm.mid.core.framework.constant.tripartite.InterfaceConstants.Action.submitCredit.key());//提交征信查询
									itlQC.setCstId(prjBscInfoVO.getCstId());//客户ID
									itlQC.setFundRasInsId(prjBscInfoVO.getFundRasInsId());
									itlQC.setStatus(cmm.mid.core.framework.constant.tripartite.InterfaceConstants.TransStatus.success.key());//成功状态
								}else{
									itlQC.setAction(cmm.mid.core.framework.constant.tripartite.InterfaceConstants.Action.submitCredit.key());//提交征信查询
									itlQC.setPrjId(Long.valueOf(projectId));
									itlQC.setFundRasInsId(prjBscInfoVO.getFundRasInsId());
								}
								BaseLogUtils.info(logger, "toAdditionalInfoPage", "===查询征信发送结果Start===prjId:"+projectId, CurrentThreadContext.getCurrentUserName());
								List<InfTransLogDTO> findTransLogs = this.transLogApi.findTransLogs(itlQC);
								BaseLogUtils.info(logger, "toAdditionalInfoPage", "===查询征信发送结果End===prjId:"+projectId+",findTransLogs:"+JSON.toJSONString(findTransLogs), CurrentThreadContext.getCurrentUserName());
								String sendStatus = "";//征信发送状态
								if(CollectionUtils.isNotEmpty(findTransLogs)){
									InfTransLogDTO infTransLogDTO = findTransLogs.get(0);
									if(null!=infTransLogDTO){
										sendStatus = infTransLogDTO.getStatus();
									}
								}
								view.addObject("sendStatus", sendStatus);//同步状态 unsent-未发送  success-发送成功  failure-发送失败
								view.addObject("sendStatusNm", this.getStatusNm(sendStatus));
								//查询征信结果
								//因为浙商没有客户信息审核结果,为了保证上线时间,这里先不做查询
								if("success".equals(sendStatus) && PrjBscInfoConstant.PRJ_INS_CODE_ZS.equals(prjBscInfoVO.getInsCode())){
									view.addObject("auditResult", "pass");//审核结果
									view.addObject("auditDesc", "");//审核描述
								}
								if("success".equals(sendStatus) && !PrjBscInfoConstant.PRJ_INS_CODE_ZS.equals(prjBscInfoVO.getInsCode())){
									PrjPrdPaySchMQueryCondition pppsmQC = new PrjPrdPaySchMQueryCondition();
									pppsmQC.setPrjId(Long.valueOf(projectId));
                                    pppsmQC.setPaySchTypCd(PrjPrdPaySchMConstant.PAY_SCH_TYP_CD_WS);
									BaseLogUtils.info(logger, "toAdditionalInfoPage", "===查询支付表信息Start===prjId:"+projectId, CurrentThreadContext.getCurrentUserName());
									List<PrjPrdPaySchMVO> prjPrdPaySchMVOList = this.prjPrdPaySchMService.searchList(pppsmQC);
									BaseLogUtils.info(logger, "toAdditionalInfoPage", "===查询支付表信息End===prjId:"+projectId+",prjPrdPaySchMVOList:"+JSON.toJSONString(prjPrdPaySchMVOList), CurrentThreadContext.getCurrentUserName());
									if(CollectionUtils.isNotEmpty(prjPrdPaySchMVOList)){
										List<Long> exclusivePrjPaySchIds = new ArrayList<Long>();
										//过滤掉上装支付表
										PrjPrdBscInfoQueryCondition ppbiQC = new PrjPrdBscInfoQueryCondition();
							    		ppbiQC.setPrjId(Long.valueOf(projectId));
							    		BaseLogUtils.info(logger, "toAdditionalInfoPage", "=查询项目产品信息Start=prjId:"+projectId);
							    		List<PrjPrdBscInfoVO> prjPrdBscInfoVOList = this.prjPrdBscInfoService.searchList(ppbiQC);
							    		BaseLogUtils.info(logger, "toAdditionalInfoPage", "=查询项目产品信息End=prjId:"+projectId+",prjPrdBscInfoVOList:"+JSON.toJSONString(prjPrdBscInfoVOList));
							    		List<Long> exclusivePrjPrdIds = new ArrayList<Long>();
							    		if(CollectionUtils.isNotEmpty(prjPrdBscInfoVOList)){
							    			for (PrjPrdBscInfoVO prjPrdBscInfoVO : prjPrdBscInfoVOList) {
												if(CarStyleConstant.PRD_TYP_8.equals(prjPrdBscInfoVO.getPrdTypCd())){
													exclusivePrjPrdIds.add(prjPrdBscInfoVO.getId());
												}
											}
							    		}
							    		PrjPrdDtlQueryCondition ppdQC = new PrjPrdDtlQueryCondition();
		                        		ppdQC.setPrjId(Long.valueOf(projectId));
		                        		BaseLogUtils.info(logger, "toAdditionalInfoPage", "=查询项目产品明细Start=prjId:"+projectId);
		                        		List<PrjPrdDtlVO> prjPrdDtlVOList = this.prjPrdDtlService.selectList(ppdQC);
		                        		BaseLogUtils.info(logger, "toAdditionalInfoPage", "=查询项目产品明细End=prjId:"+projectId+",prjPrdDtlDTOList:"+JSON.toJSONString(prjPrdDtlVOList));
		                        		if(CollectionUtils.isNotEmpty(prjPrdDtlVOList)){
		                        			for (PrjPrdDtlVO prjPrdDtlVO : prjPrdDtlVOList) {
												if(exclusivePrjPrdIds.contains(prjPrdDtlVO.getPrjPrdId())){
													exclusivePrjPaySchIds.add(prjPrdDtlVO.getPaySchId());
												}
											}
		                        		}
										List<Long> paySchIds = new ArrayList<Long>();
										for (PrjPrdPaySchMVO prjPrdPaySchMVO : prjPrdPaySchMVOList) {
											if(exclusivePrjPaySchIds.contains(prjPrdPaySchMVO.getId())){
												continue;
											}
											paySchIds.add(prjPrdPaySchMVO.getId());
										}
										BaseLogUtils.info(logger, "toAdditionalInfoPage", "===查询征信请求结果Start===prjId:"+projectId, CurrentThreadContext.getCurrentUserName());
										cmm.mid.core.framework.dto.MessageDTO<CreditDTO> queryCredit = this.tripartiteApi.queryCredit(prjBscInfoVO.getFundRasInsId(), prjBscInfoVO.getInsCode(), prjBscInfoVO.getId(), paySchIds);
										BaseLogUtils.info(logger, "toAdditionalInfoPage", "===查询征信请求结果End===prjId:"+projectId, CurrentThreadContext.getCurrentUserName());
										if(null!=queryCredit && queryCredit.isSuccess()){
											CreditDTO creditDTO = queryCredit.getData();
											if(null!=creditDTO){
												String auditResult = creditDTO.getAuditResult();
												String auditDesc = creditDTO.getAuditDesc();
												view.addObject("auditResult", auditResult);//审核结果
												view.addObject("auditDesc", auditDesc);//审核描述
											}
										}
									}
							}
						}
					}
					}
				} catch (Exception e) {
					BaseLogUtils.info(logger, "toAdditionalInfoPage", "===查询征信异常===prjId:"+projectId, CurrentThreadContext.getCurrentUserName());
					e.printStackTrace();
				}
				
				BaseLogUtils.info(logger, "toAdditionalInfoPage", "===查询租赁物数量、历史付款次数、上传资料数量Start===capPayId:"+capPayId+",capPayInfoVO:"+JSON.toJSONString(capPayInfoVO), CurrentThreadContext.getCurrentUserName());
				//Tab头 查询付款信息中租赁物数量、历史付款次数、上传资料数量
				capPayInfoVO=this.capPayInfoService.getPayInfoCount(capPayInfoVO);
				BaseLogUtils.info(logger, "toAdditionalInfoPage", "===查询租赁物数量、历史付款次数、上传资料数量End===capPayId:"+capPayId+",capPayInfoVO:"+JSON.toJSONString(capPayInfoVO), CurrentThreadContext.getCurrentUserName());
				/*if ("CDDYWYQ".equals(capPayInfoVO.getPrjTypCd())) {
					CapPayInfoQueryCondition queryCondition = new CapPayInfoQueryCondition();
					queryCondition.setPaySchId(paySchIdYq);
					queryCondition.setPaySchNo(paySchNoYq);
					List<CapPayInfoVO> capPayInfoVOS = capPayInfoService.searchList(queryCondition);
					BaseLogUtils.info(logger, "toAdditionalInfoPage", "疫情项目查询capPayInfoVOS结果为"+JSON.toJSONString(queryCondition)+",capPayInfoVOS:"+JSON.toJSONString(capPayInfoVOS));
					for (CapPayInfoVO capPayInfoVO1 : capPayInfoVOS) {
						capPayInfoVO.setPrdAmt(capPayInfoVO1.getPrdAmt() == null ? 0L : capPayInfoVO1.getPrdAmt());
					}
				}*/
				view.addObject("capPayInfoVO",capPayInfoVO);
				//查询代扣卡验证状态
				String audStsCdNm = "";
				CstBankQueryCondition cstBankQC = new CstBankQueryCondition();
				List<Long> cstIdList = new ArrayList<Long>();
				cstIdList.add(capPayInfoVO.getCstId());
				cstBankQC.setCstIdList(cstIdList);
				cstBankQC.setIsDeduct(BaseConstant.IS_YESNO_YES);
				cstBankQC.setSysCd(CurrentThreadContext.getCurrentSysCd());
				cstBankQC.setOrgCd(CurrentThreadContext.getCurrentOrgCd());
				
				BaseLogUtils.info(logger, "toAdditionalInfoPage", "===根据查询条件获取客户帐号信息Start===cstId:"+capPayInfoVO.getCstId()+",cstBankQC:"+JSON.toJSONString(cstBankQC), CurrentThreadContext.getCurrentUserName());
				List<CstBankDTO> list = this.customerQueryApiService.searchCstBankWithCstInfoList(cstBankQC);
				BaseLogUtils.info(logger, "toAdditionalInfoPage", "===根据查询条件获取客户帐号信息End===cstId:"+capPayInfoVO.getCstId()+",list:"+JSON.toJSONString(list), CurrentThreadContext.getCurrentUserName());
				if(CollectionUtils.isNotEmpty(list)){
					CstBankDTO cstBankDTO = list.get(0);
					if(null!=cstBankDTO){
						audStsCdNm = cstBankDTO.getAudStsCdNm();
					}
				}
				view.addObject("audStsCdNm", audStsCdNm);
				
				
				//收款方类型
				List<KeyValueVO> payeeTypCdList = this.capPayInfoService.getPayeeTypCdList();
				view.addObject("payeeTypCdList",JSON.toJSONString(payeeTypCdList));
				//款项
				/*List<KeyValueVO> fundTypCdList=this.capPayInfoService.getFundTypCdList();
			view.addObject("fundTypCdList",JSON.toJSONString(fundTypCdList));*/
				//付款方式
				List<KeyValueVO> payWayCdList=this.capPayInfoService.getPayWayCdList();
				view.addObject("payWayCdList",JSON.toJSONString(payWayCdList));
				//账户类型
				List<KeyValueVO> bkAccTypCdList=this.capPayInfoService.getBkAccTypCdList();
				view.addObject("bkAccTypCdList",JSON.toJSONString(bkAccTypCdList));
				//是否
				List<KeyValueVO> yesOrNOList = this.capPayInfoService.searchYesOrNOList();
				view.addObject("yesOrNOList", yesOrNOList);
				//是否团单
				List<KeyValueVO> isGrpList = this.capPayInfoService.searchIsGrpList();
				view.addObject("isGrpList", isGrpList);
				//合同签署方式
				List<KeyValueVO> cntTypCdList = this.prjBscInfoService.getCntTypCdList();
				view.addObject("cntTypCdList", cntTypCdList);
				
				//查询收款方信息
				CapPayeeInfoQueryCondition payeeInfoQueryCondition = new CapPayeeInfoQueryCondition();
				payeeInfoQueryCondition.setPayId(Long.valueOf(capPayId));
				payeeInfoQueryCondition.setSortOrder(" PURP_CD ");
				BaseLogUtils.info(logger, "toAdditionalInfoPage", "===查询放款详细信息Start===capPayId:"+capPayId+",qc:"+JSON.toJSONString(payeeInfoQueryCondition), CurrentThreadContext.getCurrentUserName());
				List<CapPayeeInfoVO> payeeVOList = capPayeeInfoService.searchList(payeeInfoQueryCondition);
				BaseLogUtils.info(logger, "toAdditionalInfoPage", "===查询放款详细信息End===capPayId:"+capPayId+",payeeVOList:"+JSON.toJSONString(payeeVOList), CurrentThreadContext.getCurrentUserName());
				
				//查询发送网银状态
				String isAllowSendPay = "0";//是否显示发送网银按钮
				List<String> purpList = new ArrayList<>(payeeVOList.size());
				Long amountPayable = 0L;
				Long amountPayables = 0L;
				Long installment = 0L;
				Long firstAmt = 0L;
				Long totalAmt = 0L;
				for (CapPayeeInfoVO capPayeeInfoVO : payeeVOList) {
					purpList.add(capPayeeInfoVO.getPurpCd());
					if(null != capPayeeInfoVO.getActPayTm()){
						capPayeeInfoVO.setActPayTms(DateUtils.formatDateToString(capPayeeInfoVO.getActPayTm(), DateUtils.YYYY_MM_DD));
					}
					
					//先查询
					BaseLogUtils.info(logger, "toAdditionalInfoPage", "===根据放款单流水号查询支付单信息Start===capPayeeId:"+capPayeeInfoVO.getId(), CurrentThreadContext.getCurrentUserName());
					InfBfsPayDTO bfsPayDTO = this.bFSApiService.selectByFlsNum(Long.valueOf(capPayeeInfoVO.getId()));
					BaseLogUtils.info(logger, "toAdditionalInfoPage", "===根据放款单流水号查询支付单信息End===capPayeeId:"+capPayeeInfoVO.getId()+",bfsPayDTO:"+JSON.toJSONString(bfsPayDTO), CurrentThreadContext.getCurrentUserName());
					//不存在	或者	发送失败	或者	付款失败		需要显示发送网银接口
					if(null==bfsPayDTO 
							|| InterfaceConstants.BfsPayStatus.payFailure.key().equals(bfsPayDTO.getStatus())
							|| InterfaceConstants.BfsPayStatus.sendFailure.key().equals(bfsPayDTO.getStatus())){
						isAllowSendPay = "1";
						capPayeeInfoVO.setIsSended(BaseConstant.IS_YESNO_NO);
					}else{
						capPayeeInfoVO.setIsSended(BaseConstant.IS_YESNO_YES);
					}
					//处理金额
					if (capPayeeInfoVO.getPurpCd().equals(CapitalConstant.CODE_SPL_BK_PURP_CD_1)) {
						Long[] payAmt = this.prjPrdDtlService.downPaymentAmount(capPayInfoVO.getPrjPrdDtlId(),capPayInfoVO.getPaySchId());
						for (int i = 0; i < payAmt.length; i++) {
							firstAmt = payAmt[0];//首期
							totalAmt = payAmt[1];//总和
						}
						if ( firstAmt != 0L && totalAmt != 0L ) {
							InsApplicationVO insApplicationVO = this.insApplicationStagingService.getInstallmentInformation(capPayInfoVO.getPrjPrdDtlId(),capPayInfoVO.getPaySchId());
							installment = 1L;
							view.addObject("insApplicationVO",insApplicationVO);
							amountPayable = capPayeeInfoVO.getRealPayAmt();
							view.addObject("amountPayableq",DecimalUtils.convertFenToYuan(amountPayable));
						}
					}
					capPayeeInfoVO.setPayAmts(String.valueOf(DecimalUtils.convertFenToYuan(capPayeeInfoVO.getPayAmt())));
					capPayeeInfoVO.setActPayAmts(capPayeeInfoVO.getActPayAmt()==null?null:String.valueOf(DecimalUtils.convertFenToYuan(capPayeeInfoVO.getActPayAmt())));
				}
				view.addObject("firstAmt",DecimalUtils.convertFenToYuan(firstAmt));
				view.addObject("totalAmt",DecimalUtils.convertFenToYuan(totalAmt));
				if ("CDDYWYQ".equals(capPayInfoVO.getPrjTypCd())) {
					view.addObject("totalAmt",DecimalUtils.convertFenToYuan(capPayInfoVO.getPayAmt()));
				}
				view.addObject("installment",installment);
				view.addObject("amountPayable",DecimalUtils.convertFenToYuan(amountPayable));
				view.addObject("accSize", purpList);
				view.addObject("isAllowSendPay", isAllowSendPay);
				view.addObject("isAllowMdfPayTypCd", isAllowSendPay);
				view.addObject("payeeList", payeeVOList);
				
				//接收流程定义URL 传过来的控制参数
				String hjzxFlag = request.getParameter("hjzxFlag");//呼叫中心:编辑是否团单:hjzxFlag 放款合同意见
				if(StringUtils.isEmpty(hjzxFlag)){
					hjzxFlag = "0";
				}
				String ctrlKey = request.getParameter("ctrlKey");//控制放款资料页签的操作 "3":不可操作  "2":验证放款资料  "1":上传/删除
				if(StringUtils.isEmpty(ctrlKey)){
					ctrlKey = "3";
				}
				String xsFlag = request.getParameter("xsFlag");//信审审核 放款抵押意见
				if(StringUtils.isEmpty(xsFlag)){
					xsFlag = "0";
				}
				String kjshFlag = request.getParameter("kjshFlag");//会计审核:核算实际付款金额(付款方)kjshFlag
				if(StringUtils.isEmpty(kjshFlag)){
					kjshFlag = "0";
				}
				String zjlFlag = request.getParameter("zjlFlag");//呈报人:可编辑收款方账号:zjlFlag=1(收款方)
				if(StringUtils.isEmpty(zjlFlag)){
					zjlFlag = "0";
				}
				String btnFlag = request.getParameter("btnFlag");//保存按钮显示 btnFlag=1
				if(StringUtils.isEmpty(btnFlag)){
					btnFlag = "0";
				}
				String zjbFlag = request.getParameter("zjbFlag");//资金部:可编辑付款方式:zjbFlag=1(收款方)
				if(StringUtils.isEmpty(zjbFlag)){
					zjbFlag = "0";
				}
				String cnFlag = request.getParameter("cnFlag"); //出纳:可编辑时间,金额:cnFlag=1(非网银)
				if(StringUtils.isEmpty(cnFlag)){
					cnFlag = "0";
				}
				String spFlag = request.getParameter("spFlag"); //上牌
				if(StringUtils.isEmpty(spFlag)){
					spFlag = "0";
				}
				String isExistSp = "";
				String spState = "0";
				Long prjPrdDtlId = capPayInfoVO.getPrjPrdDtlId();
				if(StringUtils.isNotEmpty(prjPrdDtlId)){
					//查询上牌信息
					BaseLogUtils.info(logger, "toAdditionalInfoPage", "===查询上牌信息Start===prjPrdDtlId:"+prjPrdDtlId, CurrentThreadContext.getCurrentUserName());
					PrjPrdLicInfoVO prjPrdLicInfoVO = this.prjPrdLicInfoService.selectById(prjPrdDtlId);
					BaseLogUtils.info(logger, "toAdditionalInfoPage", "===查询上牌信息End===prjPrdDtlId:"+prjPrdDtlId+",prjPrdLicInfoVO:"+JSON.toJSONString(prjPrdLicInfoVO), CurrentThreadContext.getCurrentUserName());
					if(null==prjPrdLicInfoVO){
						isExistSp = "0";
					}else{
						isExistSp = "1";
					}
					if(null!=prjPrdLicInfoVO && FlowConstant.FLOW_CHECK_STATE_PASS.equals(prjPrdLicInfoVO.getAudStsCd())){
						spState = "1";
					}
				}
				view.addObject("spState", spState);
				view.addObject("isExistSp", isExistSp);
				String dyFlag = request.getParameter("dyFlag"); //抵押
				if(StringUtils.isNotEmpty(dyFlag)){
					dyFlag = dyFlag.replace("\'", "");
				}else{
					dyFlag = "0";
				}
				//2017-3-31 String escFlag = "0";
				String escFlag = "1";
				String isExistDy = "";
				String dyState = "0";
				if(StringUtils.isNotEmpty(prjPrdDtlId)){
					//查询抵押信息
					BaseLogUtils.info(logger, "toAdditionalInfoPage", "===查询抵押信息Start===prjPrdDtlId:"+prjPrdDtlId, CurrentThreadContext.getCurrentUserName());
					PrjPrdMtgVO prjPrdMtgVO = this.prjPrdMtgService.selectById(prjPrdDtlId);
					BaseLogUtils.info(logger, "toAdditionalInfoPage", "===查询抵押信息End===prjPrdDtlId:"+prjPrdDtlId+",prjPrdMtgVO:"+JSON.toJSONString(prjPrdMtgVO), CurrentThreadContext.getCurrentUserName());
					if(null==prjPrdMtgVO){
						isExistDy = "0";
					}else{
						isExistDy = "1";
					}
					if(null!=prjPrdMtgVO && PrjPrdMtgConstant.CODE_GUAR_STS_CD_MTG.equals(prjPrdMtgVO.getGuarStsCd())){
						dyState = "1";
					}else if (null!=prjPrdMtgVO && PrjPrdMtgConstant.CODE_GUAR_STS_CD_FOR_MTG.equals(prjPrdMtgVO.getGuarStsCd())){
						dyState = "2";
					}
				}
				String checkSpPass = request.getParameter("checkSpPass"); //上牌
				if(StringUtils.isEmpty(checkSpPass)){
					checkSpPass = "0";
				}
				String checkDyPass = request.getParameter("checkDyPass"); //上牌
				if(StringUtils.isEmpty(checkDyPass)){
					checkDyPass = "0";
				}
				view.addObject("checkSpPass", checkSpPass);
				view.addObject("checkDyPass", checkDyPass);

				view.addObject("dyState", dyState);
				view.addObject("escFlag", escFlag);
				view.addObject("dyFlag", dyFlag);
				view.addObject("isExistDy", isExistDy);
				
				view.addObject("btnFlag", btnFlag);
				view.addObject("hjzxFlag", hjzxFlag);
				view.addObject("kjshFlag", kjshFlag);
				view.addObject("zjlFlag", zjlFlag);
				view.addObject("zjbFlag", zjbFlag);
				view.addObject("cnFlag", cnFlag);
				view.addObject("xsFlag", xsFlag);
				view.addObject("spFlag", spFlag);
				view.addObject("ctrlKey", ctrlKey);
				
				String isCPCW = request.getParameter("isCPCW");
				view.addObject("isCPCW", isCPCW);
				String isNeedCallback = request.getParameter("isNeedCallback");
				view.addObject("isNeedCallback", isNeedCallback);
				String bhFlag = request.getParameter("bhFlag");//是否可以维护驳回意见
				view.addObject("bhFlag", bhFlag);
				
				String checkSp = request.getParameter("checkSp");//是否有验证上牌信息权限
				view.addObject("checkSp", checkSp);
				String checkDy = request.getParameter("checkDy");//是否有验证抵押信息权限
				view.addObject("checkDy", checkDy);
				
				//by YAOXIURONG 17-9-1
				String QZTX = request.getParameter("QZTX");//起租提醒节点标识
				view.addObject("QZTX", QZTX);
				
				//by YAOXIURONG 17-9-7
				String addReturnInfo = request.getParameter("addReturnInfo");//是否可以保存实付时间和金额(网银实际付款成功确没有回传时间和金额)
				view.addObject("addReturnInfo", addReturnInfo);
				
				String confirmPay = request.getParameter("confirmPay");//付款审核
				view.addObject("confirmPay", confirmPay);
				
				String addReturnInfo_rebate = request.getParameter("addReturnInfo_rebate");//是否可以保存【返利账户】实付时间和金额
		        view.addObject("addReturnInfo_rebate", addReturnInfo_rebate);
		        String modifyRebateBank = request.getParameter("modifyRebateBank");//是否可以修改【返利账户】账户信息
		        view.addObject("modifyRebateBank", modifyRebateBank);
		        
		        String mdfIsOtherNoPass = request.getParameter("mdfIsOtherNoPass");//是否显示并支持保存修改[除"商家必要资料"外是否有不合规信息]
		        view.addObject("mdfIsOtherNoPass", mdfIsOtherNoPass);

				CstBscInfoVO cstBscInfoVO = this.cstBscInfoService.selectDetailById(capPayInfoVO.getCstId());
				if (DictionaryConstant.CODE_CERT_TYP_CD_0.equals(cstBscInfoVO.getCertTypCd())) {
					view.addObject("certNo", cstBscInfoVO.getCertNo()); // 证件号码
				}
				// String mp1 = cstBscInfoVO.getCstNpBscInfoVO().getMp1();
				String mp1 = EncryptUtil.mobileEncrypt(cstBscInfoVO.getCstNpBscInfoVO().getMp1());
				String certNo = EncryptUtil.certNoEncrypt(cstBscInfoVO.getCertNo());
				view.addObject("mp", mp1);
				view.addObject("mCertNo", certNo);
				String splRiskWarnCd = null;//供应商高风险预警标识
				String lnkRiskWarnCd = null;//挂靠公司高风险预警标识
				if (StringUtils.isNotEmpty(capPayInfoVO.getPrjPrdId()) || StringUtils.isNotEmpty(capPayInfoVO.getPrjPrdDtlId())){
					PrjPrdBscInfoVO prjPrdBscInfoVO = this.prjPrdBscInfoService.selectById(capPayInfoVO.getPrjPrdId());
					PrjPrdDtlVO prjPrdDtlVO = this.prjPrdDtlService.selectById(capPayInfoVO.getPrjPrdDtlId());
					if (prjPrdBscInfoVO != null || prjPrdDtlVO != null){
						if (prjPrdBscInfoVO.getSplId() != null || prjPrdDtlVO.getLnkCompId() != null){
							//供应商高风险预警
							SplHRiskWarnRecQC splHRiskWarnRecQC = new SplHRiskWarnRecQC();
							if (prjPrdBscInfoVO.getSplId() != null){
								splHRiskWarnRecQC.setDataId(prjPrdBscInfoVO.getSplId());
								splHRiskWarnRecQC.setDataTyp("SPL"); //SPL:供应商  LNK:挂靠公司
								splHRiskWarnRecQC.setIsWarn(1);
								splHRiskWarnRecQC.setIsDel(0);
								splHRiskWarnRecQC.setIsValid(1);
								splHRiskWarnRecQC.setIsNew(1);
							}
							List<SplHRiskWarnRecDTO> splHRiskWarnRecDTOList = splHRiskWarnRecApiService.checkSplHRiskWarnRecDTOByQC(splHRiskWarnRecQC,CurrentThreadContext.getCurrentSysCd(),CurrentThreadContext.getCurrentOrgCd(), WebBaseConstant.CHANNEL_CD);
							BaseLogUtils.info(logger, "initList", "查询供应商高风险预警接口返回：" + JSONObject.toJSONString(splHRiskWarnRecDTOList), CurrentThreadContext.getCurrentUserName());
							//挂靠公司高风险预警
							SplHRiskWarnRecQC lnkHRiskWarnRecQC = new SplHRiskWarnRecQC();
							if (prjPrdDtlVO.getLnkCompId() != null){
								lnkHRiskWarnRecQC.setDataId(prjPrdDtlVO.getLnkCompId());
								lnkHRiskWarnRecQC.setDataTyp("LNK"); //SPL:供应商  LNK:挂靠公司
								lnkHRiskWarnRecQC.setIsWarn(1);
								lnkHRiskWarnRecQC.setIsDel(0);
								lnkHRiskWarnRecQC.setIsValid(1);
								lnkHRiskWarnRecQC.setIsNew(1);
							}
							List<SplHRiskWarnRecDTO> lnkHRiskWarnRecDTOList = splHRiskWarnRecApiService.checkSplHRiskWarnRecDTOByQC(lnkHRiskWarnRecQC,CurrentThreadContext.getCurrentSysCd(),CurrentThreadContext.getCurrentOrgCd(), WebBaseConstant.CHANNEL_CD);
							BaseLogUtils.info(logger, "initList", "查询挂靠公司高风险预警接口返回：" + JSONObject.toJSONString(lnkHRiskWarnRecDTOList), CurrentThreadContext.getCurrentUserName());
							//查询供应商、挂靠公司高风险预警标识结果
							if (CollectionUtils.isNotEmpty(splHRiskWarnRecDTOList) || CollectionUtils.isNotEmpty(lnkHRiskWarnRecDTOList)){
								splRiskWarnCd = "1";
								lnkRiskWarnCd = "1";
							}
						}
					}
				}
				view.addObject("splRiskWarnCd", splRiskWarnCd);
				view.addObject("lnkRiskWarnCd", lnkRiskWarnCd);
				// 车抵贷业务（线下）、二手车交易贷 信审审核节点、信审审核抵押节点、信审审核上牌抵押节点 隐藏挂靠公司更改/移除按钮
				BaseLogUtils.error(logger, "toAdditionalInfoPage", "===项目类型===prjTypCd:" + capPayInfoVO.getPrjTypCd() + ";capPayInfoVO:" + JSON.toJSONString(capPayInfoVO), CurrentThreadContext.getCurrentUserName());
				if (PrjBscInfoConstant.PRJ_TYP_CD_CDDYWUL.equals(capPayInfoVO.getPrjTypCd()) || PrjBscInfoConstant.PRJ_TYP_CD_ESCJYD.equals(capPayInfoVO.getPrjTypCd())
                        || PrjBscInfoConstant.PRJ_TYP_CD_OWNJYD.equals(capPayInfoVO.getPrjTypCd())) {
					BaseLogUtils.error(logger, "toAdditionalInfoPage", "===项目类型===equal1:" + PrjBscInfoConstant.PRJ_TYP_CD_CDDYWUL.equals(capPayInfoVO.getPrjTypCd()) + ";equal2:" + PrjBscInfoConstant.PRJ_TYP_CD_ESCJYD.equals(capPayInfoVO.getPrjTypCd()), CurrentThreadContext.getCurrentUserName());
					view.addObject("noLinkAction", true);
				}
			} catch (BaseException e) {
				BaseLogUtils.error(logger, "toAdditionalInfoPage", "===<toAdditionalInfoPage>跳转放款流程附加信息页面BASE异常===Detail:"+e, CurrentThreadContext.getCurrentUserName());
				e.printStackTrace();
			} catch (Exception e) {
				BaseLogUtils.error(logger, "toAdditionalInfoPage", "===<toAdditionalInfoPage>跳转放款流程附加信息页面异常===Detail:"+e, CurrentThreadContext.getCurrentUserName());
				e.printStackTrace();
			}
			return view;
		}else{
			ModelAndView view = new ModelAndView("capital/flowAdditionalInfo/payFlowAdditionalPage");
			try {
				String isAuditNode = request.getParameter("isAuditNode");//是否信审节点标识
				
				String capPayId = request.getParameter("capPayId");//业务主键(付款信息ID)
				String proIntId = request.getParameter("processInstanceId");//流程实例ID
				String taskId = request.getParameter("taskId");//任务ID
				String taskDefKey = request.getParameter("taskDefKey");//任务KEY
				String taskNm = request.getParameter("taskNm");//任务名称
				if (taskNm!=null&&(taskNm.equals("信审审核")||
						taskNm.contains("信审审核抵押")||
						taskNm.contains("信审审核上牌抵押"))) {
					isAuditNode="1";
				}
				String setLeaseData = request.getParameter("setLeaseData");//资方起租日是否显示
				view.addObject("capPayId", capPayId);
				view.addObject("proIntId", proIntId);
				view.addObject("taskId", taskId);
				view.addObject("taskDefKey", taskDefKey);
				view.addObject("taskNm", taskNm);

				view.addObject("isAuditNode", isAuditNode);
				view.addObject("setLeaseData", setLeaseData);
				
				if(StringUtils.isEmpty(capPayId))throw new BaseException(BaseExceptionConstant.BASE_EXCEPTION_CODE_600, "流程中业务主键为空.");
				//查询付款信息
				BaseLogUtils.info(logger, "toAdditionalInfoPage", "===查询付款信息Start===capPayId:"+capPayId, CurrentThreadContext.getCurrentUserName());
				CapPayInfoVO capPayInfoVO=this.capPayInfoService.selectById(Long.valueOf(capPayId));
				BaseLogUtils.info(logger, "toAdditionalInfoPage", "===查询付款信息End===capPayId:"+capPayId+",capPayInfoVO:"+JSON.toJSONString(capPayInfoVO), CurrentThreadContext.getCurrentUserName());
				
				BaseLogUtils.info(logger, "toAdditionalInfoPage", "===查询租赁物数量、历史付款次数、上传资料数量Start===capPayId:"+capPayId+",capPayInfoVO:"+JSON.toJSONString(capPayInfoVO), CurrentThreadContext.getCurrentUserName());
				//Tab头 查询付款信息中租赁物数量、历史付款次数、上传资料数量
				capPayInfoVO=this.capPayInfoService.getPayInfoCount(capPayInfoVO);
				BaseLogUtils.info(logger, "toAdditionalInfoPage", "===查询租赁物数量、历史付款次数、上传资料数量End===capPayId:"+capPayId+",capPayInfoVO:"+JSON.toJSONString(capPayInfoVO), CurrentThreadContext.getCurrentUserName());
				view.addObject("capPayInfoVO",capPayInfoVO);
				//查询代扣卡验证状态
				String audStsCdNm = "";
				CstBankQueryCondition cstBankQC = new CstBankQueryCondition();
				List<Long> cstIdList = new ArrayList<Long>();
				cstIdList.add(capPayInfoVO.getCstId());
				cstBankQC.setCstIdList(cstIdList);
				cstBankQC.setIsDeduct(BaseConstant.IS_YESNO_YES);
				cstBankQC.setSysCd(CurrentThreadContext.getCurrentSysCd());
				cstBankQC.setOrgCd(CurrentThreadContext.getCurrentOrgCd());
				
				BaseLogUtils.info(logger, "toAdditionalInfoPage", "===根据查询条件获取客户帐号信息Start===cstId:"+capPayInfoVO.getCstId()+",cstBankQC:"+JSON.toJSONString(cstBankQC), CurrentThreadContext.getCurrentUserName());
				List<CstBankDTO> list = this.customerQueryApiService.searchCstBankWithCstInfoList(cstBankQC);
				BaseLogUtils.info(logger, "toAdditionalInfoPage", "===根据查询条件获取客户帐号信息End===cstId:"+capPayInfoVO.getCstId()+",list:"+JSON.toJSONString(list), CurrentThreadContext.getCurrentUserName());
				if(CollectionUtils.isNotEmpty(list)){
					CstBankDTO cstBankDTO = list.get(0);
					if(null!=cstBankDTO){
						audStsCdNm = cstBankDTO.getAudStsCdNm();
					}
				}
				view.addObject("audStsCdNm", audStsCdNm);
				
				
				//收款方类型
				List<KeyValueVO> payeeTypCdList = this.capPayInfoService.getPayeeTypCdList();
				view.addObject("payeeTypCdList",JSON.toJSONString(payeeTypCdList));
				//款项
				/*List<KeyValueVO> fundTypCdList=this.capPayInfoService.getFundTypCdList();
				view.addObject("fundTypCdList",JSON.toJSONString(fundTypCdList));*/
				//付款方式
				List<KeyValueVO> payWayCdList=this.capPayInfoService.getPayWayCdList();
				view.addObject("payWayCdList",JSON.toJSONString(payWayCdList));
				//账户类型
				List<KeyValueVO> bkAccTypCdList=this.capPayInfoService.getBkAccTypCdList();
				view.addObject("bkAccTypCdList",JSON.toJSONString(bkAccTypCdList));
				//是否
				List<KeyValueVO> yesOrNOList = this.capPayInfoService.searchYesOrNOList();
				view.addObject("yesOrNOList", yesOrNOList);
				
				//查询收款方信息
				CapPayeeInfoQueryCondition payeeInfoQueryCondition=new CapPayeeInfoQueryCondition();
				payeeInfoQueryCondition.setPayId(Long.valueOf(capPayId));
				BaseLogUtils.info(logger, "toAdditionalInfoPage", "===查询收款方信息Start===capPayId:"+capPayId, CurrentThreadContext.getCurrentUserName());
				List<CapPayeeInfoVO> payeeVOList= capPayeeInfoService.searchList(payeeInfoQueryCondition);
				BaseLogUtils.info(logger, "toAdditionalInfoPage", "===查询收款方信息End===capPayId:"+capPayId+",payeeVOList:"+JSON.toJSONString(payeeVOList), CurrentThreadContext.getCurrentUserName());
				if(CollectionUtils.isNotEmpty(payeeVOList)){//现只有一个收款方
				    view.addObject("capPayeeInfoVO",payeeVOList.get(0));
				    CapPayeeInfoVO capPayeeInfoVO = payeeVOList.get(0); 
				    //先查询
				    BaseLogUtils.info(logger, "toAdditionalInfoPage", "===根据放款单流水号查询支付单信息Start===capPayeeId:"+capPayeeInfoVO.getId(), CurrentThreadContext.getCurrentUserName());
					InfBfsPayDTO bfsPayDTO = this.bFSApiService.selectByFlsNum(Long.valueOf(capPayeeInfoVO.getId()));
					BaseLogUtils.info(logger, "toAdditionalInfoPage", "===根据放款单流水号查询支付单信息End===capPayeeId:"+capPayeeInfoVO.getId()+",bfsPayDTO:"+JSON.toJSONString(bfsPayDTO), CurrentThreadContext.getCurrentUserName());
					//存在且状态不是发送失败也不是付款失败  则说明网银已经推送 页面控制付款方式不可修改
					if(null!=bfsPayDTO 
							&& !InterfaceConstants.BfsPayStatus.payFailure.key().equals(bfsPayDTO.getStatus())
							&& !InterfaceConstants.BfsPayStatus.sendFailure.key().equals(bfsPayDTO.getStatus())){
						view.addObject("isAllowMdfPayTypCd", "0");
					}
				}
				
				//接收流程定义URL 传过来的控制参数
				String hjzxFlag = request.getParameter("hjzxFlag");//呼叫中心:编辑是否团单:hjzxFlag 放款合同意见
				if(StringUtils.isEmpty(hjzxFlag)){
					hjzxFlag = "0";
				}
				String ctrlKey = request.getParameter("ctrlKey");//控制放款资料页签的操作 "3":不可操作  "2":验证放款资料  "1":上传/删除
				if(StringUtils.isEmpty(ctrlKey)){
					ctrlKey = "3";
				}
				String xsFlag = request.getParameter("xsFlag");//信审审核 放款抵押意见
				if(StringUtils.isEmpty(xsFlag)){
					xsFlag = "0";
				}
				String kjshFlag = request.getParameter("kjshFlag");//会计审核:核算实际付款金额(付款方)kjshFlag
				if(StringUtils.isEmpty(kjshFlag)){
					kjshFlag = "0";
				}
				String zjlFlag = request.getParameter("zjlFlag");//呈报人:可编辑收款方账号:zjlFlag=1(收款方)
				if(StringUtils.isEmpty(zjlFlag)){
					zjlFlag = "0";
				}
				String btnFlag = request.getParameter("btnFlag");//保存按钮显示 btnFlag=1
				if(StringUtils.isEmpty(btnFlag)){
					btnFlag = "0";
				}
				String zjbFlag = request.getParameter("zjbFlag");//资金部:可编辑付款方式:zjbFlag=1(收款方)
				if(StringUtils.isEmpty(zjbFlag)){
					zjbFlag = "0";
				}
				String cnFlag = request.getParameter("cnFlag"); //出纳:可编辑时间,金额:cnFlag=1(非网银)
				if(StringUtils.isEmpty(cnFlag)){
					cnFlag = "0";
				}
				String spFlag = request.getParameter("spFlag"); //上牌
				if(StringUtils.isEmpty(spFlag)){
					spFlag = "0";
				}
				String isExistSp = "";
				String spState = "0";
				Long prjPrdDtlId = capPayInfoVO.getPrjPrdDtlId();
				if(StringUtils.isNotEmpty(prjPrdDtlId)){
					//查询上牌信息
					BaseLogUtils.info(logger, "toAdditionalInfoPage", "===查询上牌信息Start===prjPrdDtlId:"+prjPrdDtlId, CurrentThreadContext.getCurrentUserName());
					PrjPrdLicInfoVO prjPrdLicInfoVO = this.prjPrdLicInfoService.selectById(prjPrdDtlId);
					BaseLogUtils.info(logger, "toAdditionalInfoPage", "===查询上牌信息End===prjPrdDtlId:"+prjPrdDtlId+",prjPrdLicInfoVO:"+JSON.toJSONString(prjPrdLicInfoVO), CurrentThreadContext.getCurrentUserName());
					if(null==prjPrdLicInfoVO){
						isExistSp = "0";
					}else{
						isExistSp = "1";
					}
					if(null!=prjPrdLicInfoVO && FlowConstant.FLOW_CHECK_STATE_PASS.equals(prjPrdLicInfoVO.getAudStsCd())){
						spState = "1";
					}
				}
				view.addObject("spState", spState);
				view.addObject("isExistSp", isExistSp);
				String dyFlag = request.getParameter("dyFlag"); //抵押
				if(StringUtils.isNotEmpty(dyFlag)){
					dyFlag = dyFlag.replace("\'", "");
				}else{
					dyFlag = "0";
				}
				//2017-3-31 String escFlag = "0";
				String escFlag = "1";
				String isExistDy = "";
				String dyState = "0";
				if(StringUtils.isNotEmpty(prjPrdDtlId)){
					//查询抵押信息
					BaseLogUtils.info(logger, "toAdditionalInfoPage", "===查询抵押信息Start===prjPrdDtlId:"+prjPrdDtlId, CurrentThreadContext.getCurrentUserName());
					PrjPrdMtgVO prjPrdMtgVO = this.prjPrdMtgService.selectById(prjPrdDtlId);
					BaseLogUtils.info(logger, "toAdditionalInfoPage", "===查询抵押信息End===prjPrdDtlId:"+prjPrdDtlId+",prjPrdMtgVO:"+JSON.toJSONString(prjPrdMtgVO), CurrentThreadContext.getCurrentUserName());
					if(null==prjPrdMtgVO){
						isExistDy = "0";
					}else{
						isExistDy = "1";
					}
					if(null!=prjPrdMtgVO && PrjPrdMtgConstant.CODE_GUAR_STS_CD_MTG.equals(prjPrdMtgVO.getGuarStsCd())){
						dyState = "1";
					}else if (null!=prjPrdMtgVO && PrjPrdMtgConstant.CODE_GUAR_STS_CD_FOR_MTG.equals(prjPrdMtgVO.getGuarStsCd())){
						dyState = "2";
					}
				}
				view.addObject("dyState", dyState);
				/*2017-3-31 Long prjId = capPayInfoVO.getPrjId();
				if(StringUtils.isNotEmpty(prjId)){
					PrjBscInfoVO prjBscInfoVO = this.prjBscInfoService.selectById(prjId);
					if(null!=prjBscInfoVO && PrjBscInfoConstant.PRJ_TYP_CD_ESC.equals(prjBscInfoVO.getPrjTypCd())){
						if(null!=prjBscInfoVO){
				    		escFlag = "1";
				        	if(StringUtils.isNotEmpty(prjPrdDtlId)){
				        		//查询抵押信息
				        		PrjPrdMtgVO prjPrdMtgVO = this.prjPrdMtgService.selectById(prjPrdDtlId);
				        		if(null==prjPrdMtgVO){
				        			isExistDy = "0";
				        		}else{
				        			isExistDy = "1";
				        		}
				        	}
				    	}
					}
				}*/
				view.addObject("escFlag", escFlag);
				view.addObject("dyFlag", dyFlag);
				view.addObject("isExistDy", isExistDy);
				
				view.addObject("btnFlag", btnFlag);
				view.addObject("hjzxFlag", hjzxFlag);
				view.addObject("kjshFlag", kjshFlag);
				view.addObject("zjlFlag", zjlFlag);
				view.addObject("zjbFlag", zjbFlag);
				view.addObject("cnFlag", cnFlag);
				view.addObject("xsFlag", xsFlag);
				view.addObject("spFlag", spFlag);
				view.addObject("ctrlKey", ctrlKey);
				
				String isCPCW = request.getParameter("isCPCW");
				view.addObject("isCPCW", isCPCW);
				String isNeedCallback = request.getParameter("isNeedCallback");
				view.addObject("isNeedCallback", isNeedCallback);
				String bhFlag = request.getParameter("bhFlag");//是否可以维护驳回意见
				view.addObject("bhFlag", bhFlag);
				
				String checkSp = request.getParameter("checkSp");//是否有验证上牌信息权限
				view.addObject("checkSp", checkSp);
				String checkDy = request.getParameter("checkDy");//是否有验证抵押信息权限
				view.addObject("checkDy", checkDy);
				
				//by YAOXIURONG 17-9-1
				String QZTX = request.getParameter("QZTX");//起租提醒节点标识
				view.addObject("QZTX", QZTX);
				
				//by YAOXIURONG 17-9-7
				String addReturnInfo = request.getParameter("addReturnInfo");//是否可以保存实付时间和金额(网银实际付款成功确没有回传时间和金额)
				view.addObject("addReturnInfo", addReturnInfo);
				
				String confirmPay = request.getParameter("confirmPay");//付款审核
				view.addObject("confirmPay", confirmPay);

				String splRiskWarnCd = null;//供应商高风险预警标识
				String lnkRiskWarnCd = null;//挂靠公司高风险预警标识
				if (StringUtils.isNotEmpty(capPayInfoVO.getPrjPrdId()) || StringUtils.isNotEmpty(capPayInfoVO.getPrjPrdDtlId())){
					PrjPrdBscInfoVO prjPrdBscInfoVO = this.prjPrdBscInfoService.selectById(capPayInfoVO.getPrjPrdId());
					PrjPrdDtlVO prjPrdDtlVO = this.prjPrdDtlService.selectById(capPayInfoVO.getPrjPrdDtlId());
					if (prjPrdBscInfoVO != null || prjPrdDtlVO != null){
						if (prjPrdBscInfoVO.getSplId() != null || prjPrdDtlVO.getLnkCompId() != null){
							//供应商高风险预警
							SplHRiskWarnRecQC splHRiskWarnRecQC = new SplHRiskWarnRecQC();
							if (prjPrdBscInfoVO.getSplId() != null){
								splHRiskWarnRecQC.setDataId(prjPrdBscInfoVO.getSplId());
								splHRiskWarnRecQC.setDataTyp("SPL"); //SPL:供应商  LNK:挂靠公司
								splHRiskWarnRecQC.setIsWarn(1);
								splHRiskWarnRecQC.setIsDel(0);
								splHRiskWarnRecQC.setIsValid(1);
								splHRiskWarnRecQC.setIsNew(1);
							}
							List<SplHRiskWarnRecDTO> splHRiskWarnRecDTOList = splHRiskWarnRecApiService.checkSplHRiskWarnRecDTOByQC(splHRiskWarnRecQC,CurrentThreadContext.getCurrentSysCd(),CurrentThreadContext.getCurrentOrgCd(), WebBaseConstant.CHANNEL_CD);
							BaseLogUtils.info(logger, "initList", "查询供应商高风险预警接口返回：" + JSONObject.toJSONString(splHRiskWarnRecDTOList), CurrentThreadContext.getCurrentUserName());
							//挂靠公司高风险预警
							SplHRiskWarnRecQC lnkHRiskWarnRecQC = new SplHRiskWarnRecQC();
							if (prjPrdDtlVO.getLnkCompId() != null){
								lnkHRiskWarnRecQC.setDataId(prjPrdDtlVO.getLnkCompId());
								lnkHRiskWarnRecQC.setDataTyp("LNK"); //SPL:供应商  LNK:挂靠公司
								lnkHRiskWarnRecQC.setIsWarn(1);
								lnkHRiskWarnRecQC.setIsDel(0);
								lnkHRiskWarnRecQC.setIsValid(1);
								lnkHRiskWarnRecQC.setIsNew(1);
							}
							List<SplHRiskWarnRecDTO> lnkHRiskWarnRecDTOList = splHRiskWarnRecApiService.checkSplHRiskWarnRecDTOByQC(lnkHRiskWarnRecQC,CurrentThreadContext.getCurrentSysCd(),CurrentThreadContext.getCurrentOrgCd(), WebBaseConstant.CHANNEL_CD);
							BaseLogUtils.info(logger, "initList", "查询挂靠公司高风险预警接口返回：" + JSONObject.toJSONString(lnkHRiskWarnRecDTOList), CurrentThreadContext.getCurrentUserName());
							//查询供应商、挂靠公司高风险预警标识结果
							if (CollectionUtils.isNotEmpty(splHRiskWarnRecDTOList) || CollectionUtils.isNotEmpty(lnkHRiskWarnRecDTOList)){
								splRiskWarnCd = "1";
								lnkRiskWarnCd = "1";
							}
						}
					}
				}
				Long projectId = capPayInfoVO.getPrjId();
				PrjBscInfoVO prjBscInfoVO = prjBscInfoService.selectById(projectId);
				//系统判断方案审核结果
				if (prjBscInfoVO != null && prjBscInfoVO.getAuditInfo() != null){
					String auditInfo = prjBscInfoVO.getAuditInfo();
					if(StringUtils.isNotEmpty(auditInfo)){
						String replaceAll = auditInfo.replaceAll(">>", "</br>");
						view.addObject("auditInfo", replaceAll);
					}
				}
				view.addObject("splRiskWarnCd", splRiskWarnCd);
				view.addObject("lnkRiskWarnCd", lnkRiskWarnCd);
				// 车抵贷业务（线下）、二手车交易贷 信审审核节点、信审审核抵押节点、信审审核上牌抵押节点 隐藏挂靠公司更改/移除按钮
				BaseLogUtils.error(logger, "toAdditionalInfoPage", "===项目类型===prjTypCd:" + capPayInfoVO.getPrjTypCd() + ";capPayInfoVO:" + JSON.toJSONString(capPayInfoVO), CurrentThreadContext.getCurrentUserName());
				if (PrjBscInfoConstant.PRJ_TYP_CD_CDDYWUL.equals(capPayInfoVO.getPrjTypCd()) || PrjBscInfoConstant.PRJ_TYP_CD_ESCJYD.equals(capPayInfoVO.getPrjTypCd())
                        || PrjBscInfoConstant.PRJ_TYP_CD_OWNJYD.equals(capPayInfoVO.getPrjTypCd())) {
					BaseLogUtils.error(logger, "toAdditionalInfoPage", "===项目类型===equal1:" + PrjBscInfoConstant.PRJ_TYP_CD_CDDYWUL.equals(capPayInfoVO.getPrjTypCd()) + ";equal2:" + PrjBscInfoConstant.PRJ_TYP_CD_ESCJYD.equals(capPayInfoVO.getPrjTypCd()), CurrentThreadContext.getCurrentUserName());
					view.addObject("noLinkAction", true);
				}
			} catch (BaseException e) {
				BaseLogUtils.error(logger, "toAdditionalInfoPage", "===<toAdditionalInfoPage>跳转放款流程附加信息页面BASE异常===Detail:"+e.getMessage(), CurrentThreadContext.getCurrentUserName());
				e.printStackTrace();
			} catch (Exception e) {
				BaseLogUtils.error(logger, "toAdditionalInfoPage", "===<toAdditionalInfoPage>跳转放款流程附加信息页面异常===Detail:"+e.getMessage(), CurrentThreadContext.getCurrentUserName());
				e.printStackTrace();
			}
			return view;
		}
	}
	
	/**
	 * 跳转城配流程附加信息页面
	 */
	@RequestMapping(value = "/toAdditionalInfoList.do", method = { RequestMethod.GET, RequestMethod.POST })
	public ModelAndView toAdditionalInfoList(HttpServletRequest request, HttpServletResponse response) {
		String sysCd = CurrentThreadContext.getCurrentSysCd(); 
		String orgCd = CurrentThreadContext.getCurrentOrgCd();
		String isAuditNode = request.getParameter("isAuditNode");//是否信审节点标识
		String prjId = request.getParameter("prjId");//业务主键(项目ID)
		String proIntId = request.getParameter("processInstanceId");//流程实例ID
		String taskId = request.getParameter("taskId");//任务ID
		String taskDefKey = request.getParameter("taskDefKey");//任务KEY
		String taskNm = request.getParameter("taskNm");//任务名称
		String EmergencyContact = request.getParameter("EmergencyContact");//紧急联系人标识
		String returnvisit = request.getParameter("returnvisit");//后续回访标识
		String procNm = request.getParameter("procNm");//流程名称
		String authNm = request.getParameter("authNm");//抵押权人名称
        String exposureSource = request.getParameter("exposureSource");//是否展示敞口
        String isNeedAddTime = request.getParameter("isNeedAddTime");// 设定交车日期 =1
        String assetCd = request.getParameter("assetCd");// 自动分配处理人
		String updInsLoan = request.getParameter("updInsLoan");//东亚--
		ModelAndView view = new ModelAndView("capital/flowAdditionalInfo/payFlowAdditionalList");

		view.addObject("prjId", prjId);
		view.addObject("proIntId", proIntId);
		view.addObject("taskId", taskId);
		view.addObject("taskDefKey", taskDefKey);
		view.addObject("taskNm", taskNm);
		view.addObject("EmergencyContact", EmergencyContact);//紧急联系人标识
		view.addObject("returnvisit", returnvisit);//后续回访标识
		view.addObject("authNm", authNm);//抵押权人名称标识
		view.addObject("procNm", procNm);//流程名称
		view.addObject("isAuditNode", isAuditNode);
        view.addObject("exposureSource", exposureSource);
        view.addObject("isNeedAddTime", isNeedAddTime);
        view.addObject("assetCd", assetCd);

		//为兼容老数据，资金部审核节点，设置updInsLoan=2
		if (StringUtils.isNotEmpty(taskDefKey) && ("FLOW_00000001_002_001_079".equals(taskDefKey)
				|| "FLOW_00000001_007_001_083".equals(taskDefKey) || "FLOW_00000001_007_002_081".equals(taskDefKey)
				|| "FLOW_00000001_001_001_090".equals(taskDefKey) || "FLOW_00000008_002_002_049".equals(taskDefKey)
				|| "FLOW_00000008_007_002_052".equals(taskDefKey))){
			updInsLoan = "2";
		}
		if (StringUtils.isEmpty(updInsLoan)) updInsLoan = "0";
		view.addObject("updInsLoan",updInsLoan);

		/*CapPayInfoQueryCondition condition = new CapPayInfoQueryCondition();
		condition.setPrjId(Long.valueOf(prjId));
		List<CapPayInfoVO> capPayInfoVO = this.capPayInfoService.searchList(condition);
		for (CapPayInfoVO capPayInfoVO2 : capPayInfoVO) {
			Long prjPrdDtlId = capPayInfoVO2.getPrjPrdDtlId();
		}*/
		//抵押权人名称数据字典查询
		List<KeyValueVO> pledgeeNmList = this.sysDictionaryApiService.getKvList(DictionaryConstant.CODE_PLEDGEE_NM, sysCd, orgCd);
		view.addObject("pledgeeNmList", pledgeeNmList);
		AudReturnVisitVO audReturnVisitVO = this.audReturnVisitService.selectByProjectIdAndProIntId(Long.valueOf(prjId));//根据项目id查询信审回访表信息
		if(null != audReturnVisitVO){
			view.addObject("visitId", audReturnVisitVO.getId());
		}
		//version:2 第二个版本页面处理逻辑    version:3 第三方资管工行卡贷[工行放款确认/驻点人员添加联名卡]跳转capPayInfoModify页面
		String version = request.getParameter("version");
		view.addObject("version", version);
		
		//2018-2-22 by yaoxiurong 第三方资管工行卡贷
		String accCtrl = request.getParameter("accCtrl");
		String isAddPayerStatusCd = request.getParameter("isAddPayerStatusCd");
		String isAddBank = request.getParameter("isAddBank");
		view.addObject("accCtrl", accCtrl);
		view.addObject("isAddPayerStatusCd", isAddPayerStatusCd);
		view.addObject("isAddBank", isAddBank);
		
		String saveDueDate = request.getParameter("saveDueDate");//是否可以设置(第一期)还款日
		view.addObject("saveDueDate", saveDueDate);
		
		String mdfCntTypCd = request.getParameter("mdfCntTypCd");//是否可以修改合同签署方式  1:修改
		view.addObject("mdfCntTypCd", mdfCntTypCd);
		
		if(StringUtils.isEmpty(prjId))throw new BaseException(BaseExceptionConstant.BASE_EXCEPTION_CODE_600, "流程中业务主键为空.");
		
		//接收流程定义URL 传过来的控制参数
		String hjzxFlag = request.getParameter("hjzxFlag");//呼叫中心:编辑是否团单:hjzxFlag 放款合同意见
		if(StringUtils.isEmpty(hjzxFlag)){
			hjzxFlag = "0";
		}
		String ctrlKey = request.getParameter("ctrlKey");//控制放款资料页签的操作 "3":不可操作  "2":验证放款资料  "1":上传/删除
		if(StringUtils.isEmpty(ctrlKey)){
			ctrlKey = "3";
		}
		String xsFlag = request.getParameter("xsFlag");//信审审核 放款抵押意见
		if(StringUtils.isEmpty(xsFlag)){
			xsFlag = "0";
		}
		String kjshFlag = request.getParameter("kjshFlag");//会计审核:核算实际付款金额(付款方)kjshFlag
		if(StringUtils.isEmpty(kjshFlag)){
			kjshFlag = "0";
		}
		String zjlFlag = request.getParameter("zjlFlag");//呈报人:可编辑收款方账号:zjlFlag=1(收款方)
		if(StringUtils.isEmpty(zjlFlag)){
			zjlFlag = "0";
		}
		String btnFlag = request.getParameter("btnFlag");//保存按钮显示 btnFlag=1
		if(StringUtils.isEmpty(btnFlag)){
			btnFlag = "0";
		}
		String zjbFlag = request.getParameter("zjbFlag");//资金部:可编辑付款方式:zjbFlag=1(收款方)
		if(StringUtils.isEmpty(zjbFlag)){
			zjbFlag = "0";
		}
		String cnFlag = request.getParameter("cnFlag"); //出纳:可编辑时间,金额:cnFlag=1(非网银)
		if(StringUtils.isEmpty(cnFlag)){
			cnFlag = "0";
		}
		String spFlag = request.getParameter("spFlag"); //上牌
		if(StringUtils.isEmpty(spFlag)){
			spFlag = "0";
		}
		String dyFlag = request.getParameter("dyFlag"); //抵押
		if(StringUtils.isEmpty(dyFlag)){
        	dyFlag = "0";
        }
		
		String isCPCW = request.getParameter("isCPCW"); //城配财务付款
		if(StringUtils.isEmpty(isCPCW)){
			isCPCW = "0";
		}
		
		/*String payStsCd = request.getParameter("payStsCd");
		view.addObject("payStsCd", payStsCd);*/
		
		view.addObject("isCPCW", isCPCW);
		view.addObject("btnFlag", btnFlag);
		view.addObject("hjzxFlag", hjzxFlag);
		view.addObject("kjshFlag", kjshFlag);
		view.addObject("zjlFlag", zjlFlag);
		view.addObject("zjbFlag", zjbFlag);
		view.addObject("cnFlag", cnFlag);
		view.addObject("xsFlag", xsFlag);
		view.addObject("spFlag", spFlag);
		view.addObject("dyFlag", dyFlag);
		view.addObject("ctrlKey", ctrlKey);
		
		String checkSp = request.getParameter("checkSp");//是否有验证上牌信息权限
        view.addObject("checkSp", checkSp);
        String checkDy = request.getParameter("checkDy");//是否有验证抵押信息权限
        view.addObject("checkDy", checkDy);
        
        //by YAOXIURONG 17-9-1
        String QZTX = request.getParameter("QZTX");//起租提醒节点标识
        view.addObject("QZTX", QZTX);
        
        //by YAOXIURONG 17-9-7
        String addReturnInfo = request.getParameter("addReturnInfo");//是否可以保存实付时间和金额(网银实际付款成功确没有回传时间和金额)
        view.addObject("addReturnInfo", addReturnInfo);
        
        
        String addReturnInfo_rebate = request.getParameter("addReturnInfo_rebate");//是否可以保存【返利账户】实付时间和金额
        view.addObject("addReturnInfo_rebate", addReturnInfo_rebate);
        String modifyRebateBank = request.getParameter("modifyRebateBank");//是否可以修改【返利账户】账户信息
        view.addObject("modifyRebateBank", modifyRebateBank);
        
        String saveOrgBizOpnCd = request.getParameter("saveOrgBizOpnCd");//是否可以修改【返利账户】账户信息
        view.addObject("saveOrgBizOpnCd", saveOrgBizOpnCd);
		// 需要信审页面展示项目风险审核提醒的节点
		BaseLogUtils.newLogger("到流程附加信息页面,当前节点,projectId:{},taskDefKey:{}", prjId, taskDefKey).info();
		if (PrjRskAudWarnRecConstant.NEED_SHOW_PRJ_RSK_AUD_WARN_KEY_LIST.contains(taskDefKey)) {
			view.addObject("showPrjRskAudWarn", true);
		}
		return view;
	}

	/**
	 * 跳转抵押外派流程附加信息页面
	 */
	@RequestMapping(value = "/toDyExpBizAdditionalInfoPage.do", method = { RequestMethod.GET, RequestMethod.POST })
	public ModelAndView toDyExpBizAdditionalInfoPage(HttpServletRequest request, HttpServletResponse response){
		extSlf4jLogger.setKeywords("跳转到抵押外派流程附加信息页面").info("请求参数：{}",JSON.toJSON(request.getParameterMap()));
		ModelAndView view = new ModelAndView("capital/flowAdditionalInfo/dyExpBizAdditionalInfoPage");
		String prjPrdDtlId = request.getParameter("prjPrdDtlId");//业务主键(产品明细id)
		String isDyExpBiz = request.getParameter("isDyExpBiz");//抵押外派节点 1.随州后台(选择区域经理)  2.区域经理(选择抵押人) 3.抵押人(选择上牌地)  0.其余(仅可查看)
		view.addObject("isDyExpBiz",isDyExpBiz);

		Long prjId = null;
		if (StringUtils.isNotEmpty(prjPrdDtlId)){
			view.addObject("prjPrdDtlId",prjPrdDtlId);
			PrjPrdDtlVO prjPrdDtlVO = prjPrdDtlService.selectById(Long.valueOf(prjPrdDtlId));
			extSlf4jLogger.info("查询产品详情信息，prjPrdDtlId：{},prjPrdDtlVO:{}", prjPrdDtlId, JSON.toJSON(prjPrdDtlVO));
			if (null != prjPrdDtlVO){
				prjId = prjPrdDtlVO.getPrjId();
				view.addObject("prjId",prjId);
				view.addObject("prdMdl",prjPrdDtlVO.getPrdMdl());
				view.addObject("vin",prjPrdDtlVO.getVin());
				view.addObject("engNo",prjPrdDtlVO.getEngNo());
				view.addObject("lnkCompNm",prjPrdDtlVO.getLnkCompNm());
				view.addObject("lnkCompId",prjPrdDtlVO.getLnkCompId());
				view.addObject("paySchNo",prjPrdDtlVO.getPaySchNo());
			}

			ExpBizManRecQueryCondition expBizManRecQC = new ExpBizManRecQueryCondition();
			expBizManRecQC.setDataId(Long.valueOf(prjPrdDtlId));
			expBizManRecQC.setIsDel(0);
			expBizManRecQC.setAptTypCdList(Stream.of("1", "3").collect(Collectors.toList()));
			extSlf4jLogger.info("查询外派人员记录表信息，prjId：{},expBizManRecQC:{}", prjId, JSON.toJSON(expBizManRecQC));
			ResponseData<List<ExpBizManRecDTO>> listResponseData = expBizManRecApiService.searchList(expBizManRecQC);
			extSlf4jLogger.info("查询外派人员记录表信息，prjId：{},listResponseData:{}", prjId, JSON.toJSON(listResponseData));
			if (ResponseData.SUCCESS_CODE.equals(listResponseData.getCode()) && CollectionUtils.isNotEmpty(listResponseData.getData())){
				listResponseData.getData().forEach( dto -> {
					if ("1".equals(dto.getAptTypCd()) && "1".equals(isDyExpBiz)){
						view.addObject("areaMgrId",dto.getUsrId());
						view.addObject("areaMgrUsrNm",dto.getUsrNm());
						view.addObject("areaMgrNm",dto.getRlNm());
						view.addObject("id",dto.getId());
					}
					if ("3".equals(dto.getAptTypCd()) && "2".equals(isDyExpBiz)){
						view.addObject("mortgageMgrId",dto.getUsrId());
						view.addObject("mortgageMgrUsrNm",dto.getUsrNm());
						view.addObject("mortgageMgrNm",dto.getRlNm());
						view.addObject("id",dto.getId());
					}
					if ("3".equals(dto.getAptTypCd()) && ("3".equals(isDyExpBiz) || "0".equals(isDyExpBiz))){
						view.addObject("licRgnPrCd",dto.getLicRgnPrCd());
						view.addObject("licRgnCyCd",dto.getLicRgnCyCd());
						view.addObject("id",dto.getId());
					}
				});
			}
		}

		extSlf4jLogger.info("查询项目信息，prjId：{}", prjId);
		PrjBscInfoVO prjBscInfoVO = new PrjBscInfoVO();
		if (null != prjId){
			prjBscInfoVO = this.prjBscInfoService.selectById(prjId);
			extSlf4jLogger.info("查询项目信息，prjId：{},prjBscInfoVO:{}", prjId, JSON.toJSON(prjBscInfoVO));

			if (null != prjBscInfoVO.getCstMgrId()){
				SysUsrVO sysUsrVO = this.sysUsrService.selectById(prjBscInfoVO.getCstMgrId(), CurrentThreadContext.getCurrentSysCd());
				extSlf4jLogger.info("查询客户经理信息，prjId：{},sysUsrVO:{}", prjId, JSON.toJSON(sysUsrVO));
				if(null != sysUsrVO && StringUtils.isNotBlank(sysUsrVO.getMp())){
					view.addObject("cstMgrMp",sysUsrVO.getMp());
				}
			}
			if (null != prjBscInfoVO.getCstId()){
				CstBscInfoVO cstBscInfoVO = this.cstBscInfoService.selectDetailById(prjBscInfoVO.getCstId());
				extSlf4jLogger.info("查询客户信息，prjId：{},cstBscInfoVO:{}", prjId, JSON.toJSON(cstBscInfoVO));
				view.addObject("cstTypCd",cstBscInfoVO.getCstTypCd());
				if (null != cstBscInfoVO.getCstNpBscInfoVO()){
					CstNpBscInfoVO cstNpBscInfoVO = cstBscInfoVO.getCstNpBscInfoVO();
					view.addObject("certNo",cstBscInfoVO.getCertNo());
					view.addObject("postAddr",cstNpBscInfoVO.getPostAddr());
					String mp = StringUtils.isEmpty(cstNpBscInfoVO.getMp1()) ? cstNpBscInfoVO.getMp2() : cstNpBscInfoVO.getMp1();
					view.addObject("mp",mp);
				}
				if (null != cstBscInfoVO.getCstCorpBscInfoVO()){
					CstCorpTeamVO cstCorpTeamVO = cstBscInfoVO.getCstCorpBscInfoVO().getCstCorpTeamVO();
					if (null != cstCorpTeamVO){
						view.addObject("certNo",cstCorpTeamVO.getCertNo());
					}
					view.addObject("postAddr",cstBscInfoVO.getCstCorpBscInfoVO().getPostAddr());
					view.addObject("mp",cstBscInfoVO.getCstCorpBscInfoVO().getOfficeTel());
				}
			}

			PrjQuatPrpsQueryCondition quatQC = new PrjQuatPrpsQueryCondition();
			quatQC.setIsFormalPrps(BaseConstant.IS_YESNO_YES);
			quatQC.setPrjId(prjId);
			quatQC.setIsDel(0);
			List<PrjQuatPrpsVO> quatList = this.prjQuatPrpsService.searchList(quatQC);
			extSlf4jLogger.info("查询报价方案信息，prjId：{},quatList:{}", prjId, JSON.toJSON(quatList));
			if (CollectionUtils.isNotEmpty(quatList)){
				PrjQuatPrpsVO prjQuatPrpsVO = quatList.get(0);
				DecimalFormat df = new DecimalFormat("######0.00");//格式化保留两位小数
				if (null != prjQuatPrpsVO.getContAmt()){
					String contAmt = df.format(prjQuatPrpsVO.getContAmt());
					view.addObject("contAmt", contAmt);
				}
				if (null != prjQuatPrpsVO.getActLsAmt()){
					Double actLsAmtd = DecimalUtils.convertFenToYuan(prjQuatPrpsVO.getActLsAmt().longValue());
					String actLsAmt = df.format(actLsAmtd);
					view.addObject("actLsAmt", actLsAmt);
				}
			}
		}

		view.addObject("prjBscInfoVO",prjBscInfoVO);

		extSlf4jLogger.info("进入抵押外派附加信息页面，prjId：{},参数:{}", prjId, JSON.toJSON(view));
		return view;
	}
	
	/**
	 * 信审修改是否团单
	 */
	@RequestMapping(value = "/modifyIsGrp.do", method = { RequestMethod.POST })
	@ResponseBody
	public Object modifyIsGrp(HttpServletRequest request, HttpServletResponse response) throws BaseException {
		DataResultVO result = new DataResultVO(BaseConstant.IS_YESNO_YES,SysLogConstant.LOG_CMM_OPERATE_SUCC);
		String capPayId = request.getParameter("capPayId");
		String isGrp = request.getParameter("isGrp");
		//2018-7-9 yaoxiurong
		String isOtherNoPass = request.getParameter("isOtherNoPass");//除"商家必要资料"外是否有不合规信息
		if(StringUtils.isEmpty(isGrp)){
			//2018-7-9 yaoxiurong
			//throw new BaseException(BaseExceptionConstant.BASE_EXCEPTION_CODE_600, "是否团单不能为空.");
		}
		if(StringUtils.isEmpty(isGrp) && StringUtils.isEmpty(isOtherNoPass)){
			throw new BaseException(BaseExceptionConstant.BASE_EXCEPTION_CODE_600, "没有要保存的信息.");
		}
		if(StringUtils.isEmpty(capPayId)){
			throw new BaseException(BaseExceptionConstant.BASE_EXCEPTION_CODE_600, "付款信息ID不能为空.");
		}
		CapPayInfoVO entity = new CapPayInfoVO();
		try {
			entity.setId(Long.valueOf(capPayId));
			if(StringUtils.isNotEmpty(isGrp)){
				entity.setIsGrp(Integer.valueOf(isGrp));
			}
			if(StringUtils.isNotEmpty(isOtherNoPass)){
				entity.setIsOtherNoPass(Integer.valueOf(isOtherNoPass));
			}
			boolean success = this.capPayInfoService.modify(entity);
			if(!success){
				result.setSuccess(BaseConstant.IS_YESNO_NO);
				result.setInfo(SysLogConstant.LOG_CMM_OPERATE_FAIL);
				BaseLogUtils.info(logger, "modifyIsGrp", "信审修改是否团单失败.DATA:"+JSONObject.toJSONString(entity), CurrentThreadContext.getCurrentUserName());
				return result;
			}
			BaseLogUtils.info(logger, "modifyIsGrp", "信审修改是否团单成功.DATA:"+JSONObject.toJSONString(entity), CurrentThreadContext.getCurrentUserName());
		}catch (BaseException ex) {
			result.setSuccess(BaseConstant.IS_YESNO_NO);
			result.setInfo(SysLogConstant.LOG_CMM_SYS_ERROR+ex.getMessage());
			BaseLogUtils.info(logger, "modifyIsGrp", "信审修改是否团单失败.DATA:"+JSONObject.toJSONString(entity)+".ERROR:"+ex.getMessage(), CurrentThreadContext.getCurrentUserName());
		}catch (Exception ex) {
			result.setSuccess(BaseConstant.IS_YESNO_NO);
			result.setInfo(SysLogConstant.LOG_CMM_SYS_ERROR+ex.getMessage());
			BaseLogUtils.error(logger, "modifyIsGrp", "信审修改是否团单失败,系统错误.DATA:"+JSONObject.toJSONString(entity)+".ERROR:"+ex.getMessage(), CurrentThreadContext.getCurrentUserName());
		}
		return result;
	}
	/**
	 * 修改合同签署方式
	 * @param request
	 * @param response
	 * @return
	 * @throws BaseException
	 */
	@RequestMapping(value = "/modifyCntTypCd.do", method = { RequestMethod.POST })
	@ResponseBody
	public Object modifyCntTypCd(HttpServletRequest request, HttpServletResponse response) throws BaseException {
		DataResultVO result = new DataResultVO(BaseConstant.IS_YESNO_YES,SysLogConstant.LOG_CMM_OPERATE_SUCC);
		String prjId = request.getParameter("prjId");
		String cntTypCd = request.getParameter("cntTypCd");
		if(StringUtils.isEmpty(prjId)){
			throw new BaseException(BaseExceptionConstant.BASE_EXCEPTION_CODE_600, "项目ID不能为空.");
		}
		if(StringUtils.isEmpty(cntTypCd)){
			throw new BaseException(BaseExceptionConstant.BASE_EXCEPTION_CODE_600, "合同签署方式不能为空.");
		}
		PrjBscInfoVO entity = new PrjBscInfoVO();
		try {
			entity.setId(Long.valueOf(prjId));
			entity.setCntTypCd(cntTypCd);
			boolean success = this.projectApiService.modifyPrjBscInfo2(PrjBscInfoVOTransform.toDTO(entity));
			if(!success){
				result.setSuccess(BaseConstant.IS_YESNO_NO);
				result.setInfo(SysLogConstant.LOG_CMM_OPERATE_FAIL);
				BaseLogUtils.info(logger, "modifyCntTypCd", "修改合同签署方式失败.DATA:"+JSONObject.toJSONString(entity), CurrentThreadContext.getCurrentUserName());
				return result;
			}
			BaseLogUtils.info(logger, "modifyCntTypCd", "修改合同签署方式成功.DATA:"+JSONObject.toJSONString(entity), CurrentThreadContext.getCurrentUserName());
		}catch (BaseException ex) {
			result.setSuccess(BaseConstant.IS_YESNO_NO);
			result.setInfo(SysLogConstant.LOG_CMM_SYS_ERROR+ex.getMessage());
			BaseLogUtils.info(logger, "modifyCntTypCd", "修改合同签署方式失败.DATA:"+JSONObject.toJSONString(entity)+".ERROR:"+ex.getMessage(), CurrentThreadContext.getCurrentUserName(),ex);
		}catch (Exception ex) {
			result.setSuccess(BaseConstant.IS_YESNO_NO);
			result.setInfo(SysLogConstant.LOG_CMM_SYS_ERROR+ex.getMessage());
			BaseLogUtils.error(logger, "modifyCntTypCd", "修改合同签署方式失败,系统错误.DATA:"+JSONObject.toJSONString(entity)+".ERROR:"+ex.getMessage(), CurrentThreadContext.getCurrentUserName(),ex);
		}
		return result;
	}
	/**
	 * 保存三方业务处理意见
	 * @param request
	 * @param response
	 * @return
	 * @throws BaseException
	 */
	@RequestMapping(value = "/modifyOrgBizOpnCd.do", method = { RequestMethod.POST })
	@ResponseBody
	public Object modifyOrgBizOpnCd(HttpServletRequest request, HttpServletResponse response) throws BaseException {
		DataResultVO result = new DataResultVO(BaseConstant.IS_YESNO_YES,SysLogConstant.LOG_CMM_OPERATE_SUCC);
		String prjId = request.getParameter("prjId");
		String orgBizOpnCd = request.getParameter("orgBizOpnCd");
		if(StringUtils.isEmpty(prjId)){
			throw new BaseException(BaseExceptionConstant.BASE_EXCEPTION_CODE_600, "项目ID不能为空.");
		}
		if(StringUtils.isEmpty(orgBizOpnCd)){
			throw new BaseException(BaseExceptionConstant.BASE_EXCEPTION_CODE_600, "三方业务处理意见不能为空.");
		}
		PrjBscExtDTO entity;
		try {
			entity = this.prjBscExtApiService.searchById(Long.valueOf(prjId));
			if(null==entity){
				entity = new PrjBscExtDTO();
				entity.setId(Long.valueOf(prjId));
				entity.setOrgBizOpnCd(orgBizOpnCd);
				Long addId = this.prjBscExtApiService.addPrjBscExtDTO(entity);
				if(null==addId){
					result.setSuccess(BaseConstant.IS_YESNO_NO);
					result.setInfo(SysLogConstant.LOG_CMM_OPERATE_FAIL);
					BaseLogUtils.info(logger, "modifyCntTypCd", "保存三方业务处理意见失败.DATA:"+JSONObject.toJSONString(entity), CurrentThreadContext.getCurrentUserName());
					return result;
				}
			}else{
				entity.setOrgBizOpnCd(orgBizOpnCd);
				DataResultDTO dataResultDTO = this.prjBscExtApiService.modify(entity);
				if(dataResultDTO==null || dataResultDTO.getSuccess()==0){
					result.setSuccess(BaseConstant.IS_YESNO_NO);
					result.setInfo(SysLogConstant.LOG_CMM_OPERATE_FAIL);
					BaseLogUtils.info(logger, "modifyCntTypCd", "保存三方业务处理意见失败.DATA:"+JSONObject.toJSONString(entity), CurrentThreadContext.getCurrentUserName());
					return result;
				}
			}
			BaseLogUtils.info(logger, "modifyCntTypCd", "保存三方业务处理意见成功.DATA:"+JSONObject.toJSONString(entity), CurrentThreadContext.getCurrentUserName());
		}catch (BaseException ex) {
			result.setSuccess(BaseConstant.IS_YESNO_NO);
			result.setInfo(SysLogConstant.LOG_CMM_SYS_ERROR+ex.getMessage());
			BaseLogUtils.info(logger, "modifyCntTypCd", "保存三方业务处理意见失败.DATA:"+prjId+",orgBizOpnCd:"+orgBizOpnCd+".ERROR:"+ex.getMessage(), CurrentThreadContext.getCurrentUserName(),ex);
		}catch (Exception ex) {
			result.setSuccess(BaseConstant.IS_YESNO_NO);
			result.setInfo(SysLogConstant.LOG_CMM_SYS_ERROR+ex.getMessage());
			BaseLogUtils.error(logger, "modifyCntTypCd", "保存三方业务处理意见失败,系统错误.DATA:"+prjId+",orgBizOpnCd:"+orgBizOpnCd+".ERROR:"+ex.getMessage(), CurrentThreadContext.getCurrentUserName(),ex);
		}
		return result;
	}
	/**
	 * 修改应付款金额
	 */
	@RequestMapping(value = "/modifyPayAmt.do", method = { RequestMethod.POST })
	@ResponseBody
	public Object modifyPayAmt(HttpServletRequest request, HttpServletResponse response) throws BaseException {
		DataResultVO result = new DataResultVO(BaseConstant.IS_YESNO_YES,SysLogConstant.LOG_CMM_OPERATE_SUCC);
		String capPayId = request.getParameter("capPayId");
		String payAmt = request.getParameter("payAmt");
		if(StringUtils.isEmpty(payAmt)){
			throw new BaseException(BaseExceptionConstant.BASE_EXCEPTION_CODE_600, "应付款金额不能为空.");
		}
		if(StringUtils.isEmpty(capPayId)){
			throw new BaseException(BaseExceptionConstant.BASE_EXCEPTION_CODE_600, "付款信息ID不能为空.");
		}
		CapPayInfoVO entity = new CapPayInfoVO();
		try {
			String isFstCol=request.getParameter("isFstCol");//是否代收首付款
			if(StringUtils.isNotBlank(isFstCol)){
	            if("true".equals(isFstCol)){
	                entity.setIsFstCol(1);
	            }else{
	                entity.setIsFstCol(0);
	            }
	        }
			entity.setId(Long.valueOf(capPayId));
			entity.setPayAmt(DecimalUtils.convertYuanToFen(Double.valueOf(payAmt)));
			entity.setMdfTm(new Date());
			entity.setMdfUsrId(CurrentThreadContext.getCurrentUserId());
			boolean success = this.capPayInfoService.modify(entity);
			if(!success){
				result.setSuccess(BaseConstant.IS_YESNO_NO);
				result.setInfo(SysLogConstant.LOG_CMM_OPERATE_FAIL);
				BaseLogUtils.info(logger, "modifyPayAmt", "保存应付款金额失败.capPayId:"+capPayId+",payAmt:"+payAmt, CurrentThreadContext.getCurrentUserName());
				return result;
			}
			BaseLogUtils.info(logger, "modifyPayAmt", "保存应付款金额成功.capPayId:"+capPayId+",payAmt:"+payAmt, CurrentThreadContext.getCurrentUserName());
		}catch (BaseException ex) {
			result.setSuccess(BaseConstant.IS_YESNO_NO);
			result.setInfo(SysLogConstant.LOG_CMM_SYS_ERROR+ex.getMessage());
			BaseLogUtils.info(logger, "modifyPayAmt", "保存应付款金额失败.capPayId:"+capPayId+",payAmt:"+payAmt+".ERROR:"+ex.getMessage(), CurrentThreadContext.getCurrentUserName());
		}catch (Exception ex) {
			result.setSuccess(BaseConstant.IS_YESNO_NO);
			result.setInfo(SysLogConstant.LOG_CMM_SYS_ERROR+ex.getMessage());
			BaseLogUtils.error(logger, "modifyPayAmt", "保存应付款金额失败,系统错误.capPayId:"+capPayId+",payAmt:"+payAmt+".ERROR:"+ex.getMessage(), CurrentThreadContext.getCurrentUserName());
		}
		return result;
	}
	/**
	 * 资金部/出纳维护收款方信息
	 */
	@RequestMapping(value = "/modifyCapPayeeInfo.do", method = { RequestMethod.POST })
	@ResponseBody
	public Object modifyCapPayeeInfo(HttpServletRequest request, HttpServletResponse response) throws BaseException {
		DataResultVO result = new DataResultVO(BaseConstant.IS_YESNO_YES,SysLogConstant.LOG_CMM_OPERATE_SUCC);
		CapPayInfoVO entity = new CapPayInfoVO();
		try {
			entity = this.getRequestParamForCapPayInfo(request);
			boolean success = this.capPayInfoService.modify(entity);
			if(!success){
				result.setSuccess(BaseConstant.IS_YESNO_NO);
				result.setInfo(SysLogConstant.LOG_CMM_OPERATE_FAIL);
				BaseLogUtils.info(logger, "modifyCapPayeeInfo", "资金部/出纳维护收款方信息失败.DATA:"+JSONObject.toJSONString(entity), CurrentThreadContext.getCurrentUserName());
				return result;
			}
			BaseLogUtils.info(logger, "modifyCapPayeeInfo", "资金部/出纳维护收款方信息成功.DATA:"+JSONObject.toJSONString(entity), CurrentThreadContext.getCurrentUserName());
		}catch (BaseException ex) {
			result.setSuccess(BaseConstant.IS_YESNO_NO);
			result.setInfo(SysLogConstant.LOG_CMM_SYS_ERROR+ex.getMessage());
			BaseLogUtils.info(logger, "modifyCapPayeeInfo", "资金部/出纳维护收款方信息失败.DATA:"+JSONObject.toJSONString(entity)+".ERROR:"+ex.getMessage(), CurrentThreadContext.getCurrentUserName());
		}catch (Exception ex) {
			result.setSuccess(BaseConstant.IS_YESNO_NO);
			result.setInfo(SysLogConstant.LOG_CMM_SYS_ERROR+ex.getMessage());
			BaseLogUtils.error(logger, "modifyCapPayeeInfo", "资金部/出纳维护收款方信息失败,系统错误.DATA:"+JSONObject.toJSONString(entity)+".ERROR:"+ex.getMessage(), CurrentThreadContext.getCurrentUserName());
		}
		return result;
	}
	
	/**
	 * 获取收款方信息
	 * @param request
	 * @return
	 * @throws BaseException
	 */
	private CapPayInfoVO getRequestParamForCapPayInfo(HttpServletRequest request) throws BaseException{
		//获取参数
		String id = request.getParameter("id");//主键
        //String payStsCd = request.getParameter("payStsCd");//付款状态（CAP0008）: 未申请，申请中，已放款
        String payTypCd = request.getParameter("payTypCd");//付款类型（CAP0009）: 正常放款,提前付款,特殊放款
        String payer = request.getParameter("payer");//付款方
        String payerAccNo = request.getParameter("payerAccNo");//付款方银行账号
        String payerBkNm = request.getParameter("payerBkNm");//付款方开户行
        String payAmt = request.getParameter("payAmt");//应付金额
        String payRem = request.getParameter("payRem");//付款备注
        String isFstCol=request.getParameter("isFstCol");//是否代收首付款
        //String payee=request.getParameter("payee");//收款方
		//支付表ID
		String paySchId = request.getParameter("paySchId");

        String payeeId=request.getParameter("payeeId");//收款方ID
        String payeeTypCd = request.getParameter("payeeTypCd");//收款方类型 1.供应商 2.承租人
        String bkId = request.getParameter("bkId");//供应商/承租人银行账户ID
        String rcptUnt = request.getParameter("rcptUnt");//收款单位/人
        String accNo = request.getParameter("accNo");//收款账号
        String actPayAmt = request.getParameter("actPayAmt");//实际付款金额
        String actPayTm = request.getParameter("actPayTm");//实际付款时间
        String bkAccTypCd=request.getParameter("bkAccTypCd");//银行账户类型
        String payeeBkNm=request.getParameter("payeeBkNm");//收款方开户行
        String payeeBkNo=request.getParameter("payeeBkNo");//开户行号
        String payWayCd=request.getParameter("payWayCd");//支付方式
        
        if(StringUtils.isEmpty(id)){
        	throw new BaseException(BaseExceptionConstant.BASE_EXCEPTION_CODE_600, "修改收款方信息,主键参数为空.");
        }
        if(StringUtils.isEmpty(payeeId)){
        	throw new BaseException(BaseExceptionConstant.BASE_EXCEPTION_CODE_600, "修改收款方信息,收款ID为空.");
        }

		//验证参数并赋值
		CapPayInfoVO entity = new CapPayInfoVO();
		
		if(StringUtils.isNotBlank(isFstCol)){
            if("true".equals(isFstCol)){
                entity.setIsFstCol(1);
            }else{
                entity.setIsFstCol(0);
            }
        }
        if(StringUtils.isNotEmpty(paySchId)){
			entity.setPaySchId(Long.valueOf(paySchId));
		}

        //收款方信息
        CapPayeeInfoVO payeeInfoVO=new CapPayeeInfoVO();
        if(StringUtils.isNotEmpty(payeeId)){
            payeeInfoVO.setId(Long.valueOf(payeeId));
        }
        if(StringUtils.isNotBlank(bkAccTypCd)){
            payeeInfoVO.setBkAccTypCd(bkAccTypCd);
        }else{
            throw new BaseException(BaseExceptionConstant.BASE_EXCEPTION_CODE_604, "收款方信息不全,账户类型不能为空");
        }
        if(StringUtils.isNotBlank(payeeBkNm)){
            payeeInfoVO.setPayeeBkNm(payeeBkNm);
        }else{
            throw new BaseException(BaseExceptionConstant.BASE_EXCEPTION_CODE_604, "收款方信息不全,开户行不能为空");
        }
        if(StringUtils.isNotBlank(payeeBkNo)){
            payeeInfoVO.setPayeeBkNo(payeeBkNo);
        }else{
            throw new BaseException(BaseExceptionConstant.BASE_EXCEPTION_CODE_604, "收款方信息不全,开户行号不能为空");
        }
        if(StringUtils.isNotBlank(payWayCd)){
            payeeInfoVO.setPayWayCd(payWayCd);
        }
        if(StringUtils.isNotBlank(accNo)){
            payeeInfoVO.setAccNo(accNo);
        }else{
            throw new BaseException(BaseExceptionConstant.BASE_EXCEPTION_CODE_604, "收款方信息不全,收款账户不能为空");
        }
        if(StringUtils.isNotBlank(payeeTypCd)){
            payeeInfoVO.setPayeeTypCd(payeeTypCd);
        }else{
            throw new BaseException(BaseExceptionConstant.BASE_EXCEPTION_CODE_604, "收款方信息不全,收款账户类型不能为空");
        }
        if(StringUtils.isNotBlank(bkId)){
            payeeInfoVO.setBkId(Long.valueOf(bkId));
        }
        if(StringUtils.isNotBlank(rcptUnt)){
            payeeInfoVO.setRcptUnt(rcptUnt);
        }else{
            throw new BaseException(BaseExceptionConstant.BASE_EXCEPTION_CODE_604, "收款方信息不全,收款单位(人)不能为空");
        }
        if(StringUtils.isNotBlank(actPayAmt)){
            payeeInfoVO.setActPayAmt(DecimalUtils.convertYuanToFen(Double.valueOf(actPayAmt)));
        }
        if(StringUtils.isNotBlank(actPayTm)){
            payeeInfoVO.setActPayTm(DateUtils.formatStringToDate(actPayTm,DateUtils.YYYY_MM_DD));
        }

        List<CapPayeeInfoVO> payees= new ArrayList<CapPayeeInfoVO>();
        payees.add(payeeInfoVO);
        entity.setPayTypCd(payTypCd);//付款类型（CAP0009）: 正常放款,提前付款,特殊放款
        entity.setPayer(payer);//付款方
        entity.setPayerAccNo(payerAccNo);//付款方银行账号
        entity.setPayerBkNm(payerBkNm);//付款方开户行
        if(StringUtils.isNotEmpty(payAmt)){
        	entity.setPayAmt(DecimalUtils.convertYuanToFen(Double.valueOf(payAmt)));//应付金额
        }
        entity.setPayRem(payRem);//付款备注
        entity.setPayeeList(payees);

		Date tm=new Date();
		if (StringUtils.isNotBlank(id)) {
			entity.setId(Long.valueOf(id));
			entity.setMdfTm(tm);
			entity.setMdfUsrId(CurrentThreadContext.getCurrentUserId());
		}else{
			entity.setCrtTm(tm);
			entity.setCrtUsrId(CurrentThreadContext.getCurrentUserId());
		}
		
		return entity;
	}
	
	/**
	 * 向资金系统发送付款请求
	 */
	@RequestMapping(value = "/toSendPay.do", method = { RequestMethod.GET,RequestMethod.POST})
	@ResponseBody
	public Object toSendPay(HttpServletRequest request, HttpServletResponse response) {
		DataResultVO result = new DataResultVO(BaseConstant.IS_YESNO_YES, SysLogConstant.LOG_CMM_OPERATE_SUCC);
		String capPayId = request.getParameter("capPayId");//付款ID
		if(StringUtils.isEmpty(capPayId)){
			result.setSuccess(BaseConstant.IS_YESNO_NO);
			result.setInfo(SysLogConstant.LOG_CMM_DATA_PK_IS_EMPTY);
			BaseLogUtils.info(logger, "toSendPay", SysLogConstant.LOG_CMM_DATA_PK_IS_EMPTY, CurrentThreadContext.getCurrentUserName());
			return result;
		}
		CapPayInfoVO capPayInfoVO = this.capPayInfoService.selectById(Long.valueOf(capPayId));
		Long prjId = capPayInfoVO.getPrjId();
		Long paySchId = capPayInfoVO.getPaySchId();
		
		String payeeId = request.getParameter("payeeId");//收款方ID
		if(StringUtils.isEmpty(payeeId)){
			result.setSuccess(BaseConstant.IS_YESNO_NO);
			result.setInfo(SysLogConstant.LOG_CMM_DATA_PK_IS_EMPTY);
			BaseLogUtils.info(logger, "toSendPay", SysLogConstant.LOG_CMM_DATA_PK_IS_EMPTY, CurrentThreadContext.getCurrentUserName());
			return result;
		}
		//查询付款方式 是否 保存为网银 
		CapPayeeInfoDTO capPayeeInfoDTO = this.capPayeeInfoApiService.selectCapPayeeInfoById(Long.valueOf(payeeId));
		String payWayCd = capPayeeInfoDTO.getPayWayCd();
		if(!CapPayeeInfoConstant.CODE_PAYEE_PAY_WAY_CD_EBANK.equals(payWayCd)){
			result.setSuccess(BaseConstant.IS_YESNO_NO);
			result.setInfo("请确认付款方式为外付网银!");
			BaseLogUtils.info(logger, "toSendPay", "请确认付款方式为外付网银!", CurrentThreadContext.getCurrentUserName());
			return result;
		}
		
		HttpSession session = request.getSession();
		try {
			
			//校验合同是否签署
			this.prjContService.chcekContAllIsSign(prjId, paySchId, CurrentThreadContext.getCurrentUserId());
			//先查询
			InfBfsPayDTO bfsPayDTO = this.bFSApiService.selectByFlsNum(Long.valueOf(payeeId));
			//存在且状态不是发送失败也不是付款失败  则不允许再次发起
			if(null!=bfsPayDTO 
					&& !InterfaceConstants.BfsPayStatus.payFailure.key().equals(bfsPayDTO.getStatus())
					&& !InterfaceConstants.BfsPayStatus.sendFailure.key().equals(bfsPayDTO.getStatus())){
				result.setSuccess(BaseConstant.IS_YESNO_NO);
				result.setInfo("放款单处理中,不允许多次请求放款.");
				BaseLogUtils.info(logger, "toSendPay", "向资金系统发送付款单信息,校验失败,付款单信息已存在.", CurrentThreadContext.getCurrentUserName());
				return result;
			}
			
			//2017-9-15 by YAOXIURONNG 发送网银加入控制 在第一次没有返回结果的情况下不能发送第二次
			Object sessionObj = session.getAttribute(payeeId);
			if(null!=sessionObj){
				result.setSuccess(BaseConstant.IS_YESNO_NO);
				result.setInfo("请求处理中,请勿重复操作.");
			}else{
				session.setAttribute(payeeId, payeeId);
				MessageDTO<String> sendPayMsg =null;
				Long rule= this.capPayeeInfoApiService.payRule(Long.valueOf(payeeId));
				if(rule!=null&&rule>2L){
					BaseLogUtils.info(logger, "sendSynchroPayeeInfo", "发送自动网银开始payeeId:"+payeeId+",sendPayMsg:"+JSON.toJSONString(sendPayMsg));
					
					sendPayMsg=this.bFSApiService.sendSynchroPayeeInfo(Long.valueOf(payeeId));
					BaseLogUtils.info(logger, "sendSynchroPayeeInfo", "发送自动网银结束payeeId:"+payeeId+",sendPayMsg:"+JSON.toJSONString(sendPayMsg));
					
				}else if(rule==null){
					BaseLogUtils.info(logger, "sendPay", "发送手动网银开始payeeId:"+payeeId+",sendPayMsg:"+JSON.toJSONString(sendPayMsg));
					
					sendPayMsg=this.bFSApiService.sendPay(Long.valueOf(payeeId));
					BaseLogUtils.info(logger, "sendPay", "发送手动网银结束payeeId:"+payeeId+",sendPayMsg:"+JSON.toJSONString(sendPayMsg));
					
				}else if (rule==0) {
					throw new BaseException(BaseExceptionConstant.BASE_EXCEPTION_CODE_605, "匹配帐号错误!");
				}else if (rule==1) {
					throw new BaseException(BaseExceptionConstant.BASE_EXCEPTION_CODE_605, "未匹配到机构帐号!");
				}else if (rule==2) {
					throw new BaseException(BaseExceptionConstant.BASE_EXCEPTION_CODE_605, "机构帐号余额不足!");
				}
				if(sendPayMsg.isSuccess()){
					result.setSuccess(BaseConstant.IS_YESNO_YES);
					result.setInfo("请求发送成功,请等待处理结果.");
					BaseLogUtils.info(logger, "toSendPay", "向资金系统发送付款单信息成功.", CurrentThreadContext.getCurrentUserName());
				}else{
					result.setSuccess(BaseConstant.IS_YESNO_NO);
					result.setInfo("请求发送失败,请稍后重试.");
					BaseLogUtils.info(logger, "toSendPay", "向资金系统发送付款单信息失败.", CurrentThreadContext.getCurrentUserName());
				}
			}
		} catch (BaseException ex) {
			result.setSuccess(BaseConstant.IS_YESNO_NO);
			result.setInfo(ex.getMessage());
			BaseLogUtils.info(logger, "toSendPay", "向资金系统发送付款请求失败.DATA:"+payeeId+".ERROR:"+ex.getMessage(), CurrentThreadContext.getCurrentUserName());
		}catch (Exception ex) {
			result.setSuccess(BaseConstant.IS_YESNO_NO);
			result.setInfo(SysLogConstant.LOG_CMM_SYS_ERROR+ex.getMessage());
			BaseLogUtils.error(logger, "toSendPay", "向资金系统发送付款请求失败,系统错误.DATA:"+payeeId+".ERROR:"+ex.getMessage(), CurrentThreadContext.getCurrentUserName());
		}
		session.removeAttribute(payeeId);
		return result;
	}
	/**
	 * 向资金系统发送付款请求
	 */
	@RequestMapping(value = "/toSendPayV2.do", method = { RequestMethod.POST})
	@ResponseBody
	public Object toSendPayV2(HttpServletRequest request, HttpServletResponse response) {
		DataResultVO result = new DataResultVO(BaseConstant.IS_YESNO_YES, SysLogConstant.LOG_CMM_OPERATE_SUCC);
		String capPayId = request.getParameter("capPayId");//付款ID
		if(StringUtils.isEmpty(capPayId)){
			result.setSuccess(BaseConstant.IS_YESNO_NO);
			result.setInfo(SysLogConstant.LOG_CMM_DATA_PK_IS_EMPTY);
			BaseLogUtils.info(logger, "toSendPayV2", SysLogConstant.LOG_CMM_DATA_PK_IS_EMPTY, CurrentThreadContext.getCurrentUserName());
			return result;
		}
		
		try {
			CapPayInfoVO capPayInfoVO = this.capPayInfoService.selectById(Long.valueOf(capPayId));
			Long prjId = capPayInfoVO.getPrjId();
			Long paySchId = capPayInfoVO.getPaySchId();
			//校验合同是否签署
			this.prjContService.chcekContAllIsSign(prjId, paySchId, CurrentThreadContext.getCurrentUserId());
			CapPayeeInfoQueryCondition qc = new CapPayeeInfoQueryCondition();
			qc.setPayId(Long.valueOf(capPayId));
			BaseLogUtils.info(logger, "toSendPayV2", "===查询收款明细信息Start===capPayId:"+capPayId+",QueryCondition:"+JSON.toJSONString(qc));
			List<CapPayeeInfoVO> capPayeeInfoVOList = this.capPayeeInfoService.searchList(qc);
			BaseLogUtils.info(logger, "toSendPayV2", "===查询收款明细信息End===capPayId:"+capPayId+",RESULTDATA:"+JSON.toJSONString(capPayeeInfoVOList));
			if(CollectionUtils.isNotEmpty(capPayeeInfoVOList)){
				for (CapPayeeInfoVO capPayeeInfoVO : capPayeeInfoVOList) {
					//网银付款方式
        			if(CapPayeeInfoConstant.CODE_PAYEE_PAY_WAY_CD_EBANK.equals(capPayeeInfoVO.getPayWayCd())){
        				//先查询
        				InfBfsPayDTO bfsPayDTO = this.bFSApiService.selectByFlsNum(Long.valueOf(capPayeeInfoVO.getId()));
        				//不存在	或者	发送失败	或者	付款失败
        				if(null==bfsPayDTO 
        						|| InterfaceConstants.BfsPayStatus.payFailure.key().equals(bfsPayDTO.getStatus())
        						|| InterfaceConstants.BfsPayStatus.sendFailure.key().equals(bfsPayDTO.getStatus())){
        					
        					MessageDTO<String> sendPayMsg = this.bFSApiService.sendPay(capPayeeInfoVO.getId());
        					if(!sendPayMsg.isSuccess()){
        						result.setSuccess(BaseConstant.IS_YESNO_NO);
        						result.setInfo("请求发送失败,请稍后重试.");
        						BaseLogUtils.info(logger, "toSendPayForBus", "向资金系统发送付款单信息失败.capPayeeId:"+capPayeeInfoVO.getId(), CurrentThreadContext.getCurrentUserName());
        						return result;
        					}else{
        						BaseLogUtils.info(logger, "toSendPayForBus", "向资金系统发送付款单信息成功.capPayeeId:"+capPayeeInfoVO.getId(), CurrentThreadContext.getCurrentUserName());
        					}
        				}
        			}
				}
			}
			result.setSuccess(BaseConstant.IS_YESNO_YES);
			result.setInfo("请求发送成功,请等待处理结果.");
			BaseLogUtils.info(logger, "toSendPayV2", "向资金系统发送付款单信息成功.", CurrentThreadContext.getCurrentUserName());
		} catch (BaseException ex) {
			result.setSuccess(BaseConstant.IS_YESNO_NO);
			result.setInfo(ex.getMessage());
			BaseLogUtils.info(logger, "toSendPayV2", "向资金系统发送付款请求失败.DATA:"+capPayId+".ERROR:"+ex.getMessage(), CurrentThreadContext.getCurrentUserName());
		}catch (Exception ex) {
			result.setSuccess(BaseConstant.IS_YESNO_NO);
			result.setInfo(SysLogConstant.LOG_CMM_SYS_ERROR+ex.getMessage());
			BaseLogUtils.error(logger, "toSendPayV2", "向资金系统发送付款请求失败,系统错误.DATA:"+capPayId+".ERROR:"+ex.getMessage(), CurrentThreadContext.getCurrentUserName());
		}
		return result;
	}
	
	/**
	 * 向资金系统发送付款请求  - 专车
	 */
	@RequestMapping(value = "/toSendPayForBus.do", method = { RequestMethod.POST})
	@ResponseBody
	public Object toSendPayForBus(HttpServletRequest request, HttpServletResponse response) {
		DataResultVO result = new DataResultVO(BaseConstant.IS_YESNO_YES, SysLogConstant.LOG_CMM_OPERATE_SUCC);
		String capPayId = request.getParameter("capPayId");//付款ID
		String busPayFlag = request.getParameter("busPayFlag");//专车放款发送网银标识	1:全部发送	2.发送保险,购置税		3.发送车款,经销商返利
		if(StringUtils.isEmpty(capPayId)){
			result.setSuccess(BaseConstant.IS_YESNO_NO);
			result.setInfo(SysLogConstant.LOG_CMM_DATA_PK_IS_EMPTY);
			BaseLogUtils.info(logger, "toSendPayForBus", SysLogConstant.LOG_CMM_DATA_PK_IS_EMPTY, CurrentThreadContext.getCurrentUserName());
			return result;
		}
		
		try {
			CapPayInfoVO capPayInfoVO = this.capPayInfoService.selectById(Long.valueOf(capPayId));
			Long prjId = capPayInfoVO.getPrjId();
			Long paySchId = capPayInfoVO.getPaySchId();
			
			//校验合同是否签署
			this.prjContService.chcekContAllIsSign(prjId, paySchId, CurrentThreadContext.getCurrentUserId());
			
			CapPayeeInfoQueryCondition qc = new CapPayeeInfoQueryCondition();
			qc.setPayId(Long.valueOf(capPayId));
			BaseLogUtils.info(logger, "toSendPayForBus", "===查询收款明细信息Start===capPayId:"+capPayId+",QueryCondition:"+JSON.toJSONString(qc));
			List<CapPayeeInfoVO> capPayeeInfoVOList = this.capPayeeInfoService.searchList(qc);
			BaseLogUtils.info(logger, "toSendPayForBus", "===查询收款明细信息End===capPayId:"+capPayId+",RESULTDATA:"+JSON.toJSONString(capPayeeInfoVOList));
			if("1".equals(busPayFlag)){
	        	if(CollectionUtils.isNotEmpty(capPayeeInfoVOList)){
	        		for (CapPayeeInfoVO capPayeeInfoVO : capPayeeInfoVOList) {
	        			//网银付款方式
	        			if(CapPayeeInfoConstant.CODE_PAYEE_PAY_WAY_CD_EBANK.equals(capPayeeInfoVO.getPayWayCd())){
	        				//先查询
	        				InfBfsPayDTO bfsPayDTO = this.bFSApiService.selectByFlsNum(Long.valueOf(capPayeeInfoVO.getId()));
	        				//不存在	或者	发送失败	或者	付款失败
	        				if(null==bfsPayDTO 
	        						|| InterfaceConstants.BfsPayStatus.payFailure.key().equals(bfsPayDTO.getStatus())
	        						|| InterfaceConstants.BfsPayStatus.sendFailure.key().equals(bfsPayDTO.getStatus())){
	        					MessageDTO<String> sendPayMsg = this.bFSApiService.sendPay(capPayeeInfoVO.getId());
	        					if(!sendPayMsg.isSuccess()){
	        						result.setSuccess(BaseConstant.IS_YESNO_NO);
	        						result.setInfo("请求发送失败,请稍后重试.");
	        						BaseLogUtils.info(logger, "toSendPayForBus", "向资金系统发送付款单信息失败.capPayeeId:"+capPayeeInfoVO.getId(), CurrentThreadContext.getCurrentUserName());
	        						return result;
	        					}else{
	        						BaseLogUtils.info(logger, "toSendPayForBus", "向资金系统发送付款单信息成功.capPayeeId:"+capPayeeInfoVO.getId(), CurrentThreadContext.getCurrentUserName());
	        					}
	        				}
	        			}
					}
	        	}
	        }else if("2".equals(busPayFlag)){
	        	for (CapPayeeInfoVO capPayeeInfoVO : capPayeeInfoVOList) {
	        		//网银付款方式
        			if(CapPayeeInfoConstant.CODE_PAYEE_PAY_WAY_CD_EBANK.equals(capPayeeInfoVO.getPayWayCd())){
        				String purpCd = capPayeeInfoVO.getPurpCd();
    	        		if(CapPayeeInfoConstant.CODE_PURP_CD_00000008_3.equals(purpCd)
    	        				|| CapPayeeInfoConstant.CODE_PURP_CD_00000008_4.equals(purpCd)){
    	        			//先查询
    	        			InfBfsPayDTO bfsPayDTO = this.bFSApiService.selectByFlsNum(Long.valueOf(capPayeeInfoVO.getId()));
    	        			//不存在	或者	发送失败	或者	付款失败
    	        			if(null==bfsPayDTO 
    	        					|| InterfaceConstants.BfsPayStatus.payFailure.key().equals(bfsPayDTO.getStatus())
    	        					|| InterfaceConstants.BfsPayStatus.sendFailure.key().equals(bfsPayDTO.getStatus())){
    	        				MessageDTO<String> sendPayMsg = this.bFSApiService.sendPay(capPayeeInfoVO.getId());
    	        				if(!sendPayMsg.isSuccess()){
    	        					result.setSuccess(BaseConstant.IS_YESNO_NO);
    	        					result.setInfo("请求发送失败,请稍后重试.");
    	        					BaseLogUtils.info(logger, "toSendPayForBus", "向资金系统发送付款单信息失败.capPayeeId:"+capPayeeInfoVO.getId(), CurrentThreadContext.getCurrentUserName());
    	        					return result;
    	        				}else{
    	        					BaseLogUtils.info(logger, "toSendPayForBus", "向资金系统发送付款单信息成功.capPayeeId:"+capPayeeInfoVO.getId(), CurrentThreadContext.getCurrentUserName());
    	        				}
    	        			}
    	        		}
        			}
				}
	        }else if("3".equals(busPayFlag)){
	        	for (CapPayeeInfoVO capPayeeInfoVO : capPayeeInfoVOList) {
	        		//网银付款方式
        			if(CapPayeeInfoConstant.CODE_PAYEE_PAY_WAY_CD_EBANK.equals(capPayeeInfoVO.getPayWayCd())){
        				String purpCd = capPayeeInfoVO.getPurpCd();
    	        		if(CapPayeeInfoConstant.CODE_PURP_CD_00000008_1.equals(purpCd)
    	        				|| CapPayeeInfoConstant.CODE_PURP_CD_00000008_2.equals(purpCd)){
    	        			//先查询
    	        			InfBfsPayDTO bfsPayDTO = this.bFSApiService.selectByFlsNum(Long.valueOf(capPayeeInfoVO.getId()));
    	        			//不存在	或者	发送失败	或者	付款失败
    	        			if(null==bfsPayDTO 
    	        					|| InterfaceConstants.BfsPayStatus.payFailure.key().equals(bfsPayDTO.getStatus())
    	        					|| InterfaceConstants.BfsPayStatus.sendFailure.key().equals(bfsPayDTO.getStatus())){
    	        				MessageDTO<String> sendPayMsg = this.bFSApiService.sendPay(capPayeeInfoVO.getId());
    	        				if(!sendPayMsg.isSuccess()){
    	        					result.setSuccess(BaseConstant.IS_YESNO_NO);
    	        					result.setInfo("请求发送失败,请稍后重试.");
    	        					BaseLogUtils.info(logger, "toSendPayForBus", "向资金系统发送付款单信息失败.capPayeeId:"+capPayeeInfoVO.getId(), CurrentThreadContext.getCurrentUserName());
    	        					return result;
    	        				}else{
    	        					BaseLogUtils.info(logger, "toSendPayForBus", "向资金系统发送付款单信息成功.capPayeeId:"+capPayeeInfoVO.getId(), CurrentThreadContext.getCurrentUserName());
    	        				}
    	        			}
    	        		}
        			}
				}
	        }else if("4".equals(busPayFlag)){
	        	for (CapPayeeInfoVO capPayeeInfoVO : capPayeeInfoVOList) {
	        		//网银付款方式
        			if(CapPayeeInfoConstant.CODE_PAYEE_PAY_WAY_CD_EBANK.equals(capPayeeInfoVO.getPayWayCd())){
        				String purpCd = capPayeeInfoVO.getPurpCd();
    	        		if(CapPayeeInfoConstant.CODE_PURP_CD_00000008_1.equals(purpCd)){
    	        			//先查询
    	        			InfBfsPayDTO bfsPayDTO = this.bFSApiService.selectByFlsNum(Long.valueOf(capPayeeInfoVO.getId()));
    	        			//不存在	或者	发送失败	或者	付款失败
    	        			if(null==bfsPayDTO 
    	        					|| InterfaceConstants.BfsPayStatus.payFailure.key().equals(bfsPayDTO.getStatus())
    	        					|| InterfaceConstants.BfsPayStatus.sendFailure.key().equals(bfsPayDTO.getStatus())){
    	        				MessageDTO<String> sendPayMsg = this.bFSApiService.sendPay(capPayeeInfoVO.getId());
    	        				if(!sendPayMsg.isSuccess()){
    	        					result.setSuccess(BaseConstant.IS_YESNO_NO);
    	        					result.setInfo("请求发送失败,请稍后重试.");
    	        					BaseLogUtils.info(logger, "toSendPayForBus", "向资金系统发送付款单信息失败.capPayeeId:"+capPayeeInfoVO.getId(), CurrentThreadContext.getCurrentUserName());
    	        					return result;
    	        				}else{
    	        					BaseLogUtils.info(logger, "toSendPayForBus", "向资金系统发送付款单信息成功.capPayeeId:"+capPayeeInfoVO.getId(), CurrentThreadContext.getCurrentUserName());
    	        				}
    	        			}
    	        		}
        			}
				}
	        }else if("5".equals(busPayFlag)){
	        	for (CapPayeeInfoVO capPayeeInfoVO : capPayeeInfoVOList) {
	        		//网银付款方式
        			if(CapPayeeInfoConstant.CODE_PAYEE_PAY_WAY_CD_EBANK.equals(capPayeeInfoVO.getPayWayCd())){
        				String purpCd = capPayeeInfoVO.getPurpCd();
    	        		if(CapPayeeInfoConstant.CODE_PURP_CD_00000008_2.equals(purpCd)){
    	        			//先查询
    	        			InfBfsPayDTO bfsPayDTO = this.bFSApiService.selectByFlsNum(Long.valueOf(capPayeeInfoVO.getId()));
    	        			//不存在	或者	发送失败	或者	付款失败
    	        			if(null==bfsPayDTO 
    	        					|| InterfaceConstants.BfsPayStatus.payFailure.key().equals(bfsPayDTO.getStatus())
    	        					|| InterfaceConstants.BfsPayStatus.sendFailure.key().equals(bfsPayDTO.getStatus())){
    	        				MessageDTO<String> sendPayMsg = this.bFSApiService.sendPay(capPayeeInfoVO.getId());
    	        				if(!sendPayMsg.isSuccess()){
    	        					result.setSuccess(BaseConstant.IS_YESNO_NO);
    	        					result.setInfo("请求发送失败,请稍后重试.");
    	        					BaseLogUtils.info(logger, "toSendPayForBus", "向资金系统发送付款单信息失败.capPayeeId:"+capPayeeInfoVO.getId(), CurrentThreadContext.getCurrentUserName());
    	        					return result;
    	        				}else{
    	        					BaseLogUtils.info(logger, "toSendPayForBus", "向资金系统发送付款单信息成功.capPayeeId:"+capPayeeInfoVO.getId(), CurrentThreadContext.getCurrentUserName());
    	        				}
    	        			}
    	        		}
        			}
				}
	        }
			result.setSuccess(BaseConstant.IS_YESNO_YES);
			result.setInfo("请求发送成功,请等待处理结果.");
			BaseLogUtils.info(logger, "toSendPayForBus", "向资金系统发送付款单信息成功.", CurrentThreadContext.getCurrentUserName());
		} catch (BaseException ex) {
			result.setSuccess(BaseConstant.IS_YESNO_NO);
			result.setInfo(ex.getMessage());
			BaseLogUtils.info(logger, "toSendPayForBus", "向资金系统发送付款请求失败.capPayId:"+capPayId+",busPayFlag:"+busPayFlag+".ERROR:"+ex.getMessage(), CurrentThreadContext.getCurrentUserName());
		}catch (Exception ex) {
			result.setSuccess(BaseConstant.IS_YESNO_NO);
			result.setInfo(SysLogConstant.LOG_CMM_SYS_ERROR+ex.getMessage());
			BaseLogUtils.error(logger, "toSendPayForBus", "向资金系统发送付款请求失败,系统错误.capPayId:"+capPayId+",busPayFlag:"+busPayFlag+".ERROR:"+ex.getMessage(), CurrentThreadContext.getCurrentUserName());
		}
		return result;
	}
	
	/**
	 * 城配流程  取消单张支付表放款 
	 * @param request
	 * @param response
	 * @return
	 * @throws BaseException
	 */
	@RequestMapping(value = "/cancelPay.do", method = { RequestMethod.POST })
	@ResponseBody
	public Object cancelPay(HttpServletRequest request, HttpServletResponse response) throws BaseException {
		DataResultVO result = new DataResultVO(BaseConstant.IS_YESNO_YES,SysLogConstant.LOG_CMM_OPERATE_SUCC);
		String capPayId = request.getParameter("capPayId");
		String processInstanceId = request.getParameter("processInstanceId");//流程实例ID
		if(StringUtils.isEmpty(capPayId)){
			throw new BaseException(BaseExceptionConstant.BASE_EXCEPTION_CODE_600, "付款信息ID不能为空.");
		}
		if(StringUtils.isEmpty(processInstanceId)){
			throw new BaseException(BaseExceptionConstant.BASE_EXCEPTION_CODE_600, "流程实例ID不能为空.");
		}
		CapPayInfoVO entity = new CapPayInfoVO();
		try {
			/**
			 * 首先校验
			 * 		1.网银:已发送
			 * 		2.非网银:但是有实付时间和实付金额
			 * 	以上两种情况不允许取消放款
			 */
			CapPayeeInfoQueryCondition CPIQC = new CapPayeeInfoQueryCondition();
			CPIQC.setPayId(Long.valueOf(capPayId));
			List<CapPayeeInfoVO> capPayeeInfoVOList = this.capPayeeInfoService.searchList(CPIQC);
			if(CollectionUtils.isNotEmpty(capPayeeInfoVOList)){
				CapPayeeInfoVO capPayeeInfoVO = capPayeeInfoVOList.get(0);
				String payWayCd = capPayeeInfoVO.getPayWayCd();
				if(CapPayeeInfoConstant.CODE_PAYEE_PAY_WAY_CD_EBANK.equals(payWayCd)){//网银
					//先查询
					InfBfsPayDTO bfsPayDTO = this.bFSApiService.selectByFlsNum(Long.valueOf(capPayeeInfoVO.getId()));
					//存在且状态不是发送失败也不是付款失败  则说明网银已经推送 不允许取消
					if(null!=bfsPayDTO 
							&& !InterfaceConstants.BfsPayStatus.payFailure.key().equals(bfsPayDTO.getStatus())
							&& !InterfaceConstants.BfsPayStatus.sendFailure.key().equals(bfsPayDTO.getStatus())){
						result.setSuccess(BaseConstant.IS_YESNO_NO);
						result.setInfo("付款单信息已发送网银,不允许取消放款.");
						BaseLogUtils.info(logger, "cancelPay", "取消放款,校验失败,付款单信息已发送网银.", CurrentThreadContext.getCurrentUserName());
						return result;
					}
				}else{//非网银
					if(null!=capPayeeInfoVO.getActPayAmt() || null!=capPayeeInfoVO.getActPayAmtD()){
						//实付时间 或者 实付金额 不为空
						result.setSuccess(BaseConstant.IS_YESNO_NO);
						result.setInfo("付款单信息已维护实付时间或实付金额,不允许取消放款.");
						BaseLogUtils.info(logger, "cancelPay", "取消放款,校验失败,付款单信息已维护实付时间或实付金额.", CurrentThreadContext.getCurrentUserName());
						return result;
					}
				}
			}
			
			/**
			 * 校验通过
			 * 修改付款信息 
			 * 删除付款数据关联流程记录
			 */
			boolean success = this.capPayInfoService.modifyCapSysFlowSH(Long.valueOf(capPayId), processInstanceId);
			if(!success){
				result.setSuccess(BaseConstant.IS_YESNO_NO);
				result.setInfo(SysLogConstant.LOG_CMM_OPERATE_FAIL);
				BaseLogUtils.info(logger, "cancelPay", "取消放款失败.DATA:"+JSONObject.toJSONString(entity), CurrentThreadContext.getCurrentUserName());
				return result;
			}
			BaseLogUtils.info(logger, "cancelPay", "取消放款成功.DATA:"+JSONObject.toJSONString(entity), CurrentThreadContext.getCurrentUserName());
		}catch (BaseException ex) {
			result.setSuccess(BaseConstant.IS_YESNO_NO);
			result.setInfo(SysLogConstant.LOG_CMM_SYS_ERROR+ex.getMessage());
			BaseLogUtils.info(logger, "cancelPay", "取消放款失败.DATA:"+JSONObject.toJSONString(entity)+".ERROR:"+ex.getMessage(), CurrentThreadContext.getCurrentUserName());
		}catch (Exception ex) {
			result.setSuccess(BaseConstant.IS_YESNO_NO);
			result.setInfo(SysLogConstant.LOG_CMM_SYS_ERROR+ex.getMessage());
			BaseLogUtils.error(logger, "cancelPay", "取消放款失败,系统错误.DATA:"+JSONObject.toJSONString(entity)+".ERROR:"+ex.getMessage(), CurrentThreadContext.getCurrentUserName());
		}
		return result;
	}
	
	/**
	 * 修改上牌验证状态
	 * @param request
	 * @param response
	 * @return
	 * @throws BaseException
	 */
	@RequestMapping(value = "/modifySpStatus.do", method = {RequestMethod.POST })
	@ResponseBody
	public DataResultVO modifySpStatus(HttpServletRequest request, HttpServletResponse response) throws BaseException {
		String audStsCd = request.getParameter("audStsCd");
		String id = request.getParameter("id");
		String prjId = request.getParameter("prjId");
		DataResultVO result = new DataResultVO(BaseConstant.IS_YESNO_YES, SysLogConstant.LOG_CMM_OPERATE_SUCC);
		if(StringUtils.isEmpty(id) || StringUtils.isEmpty(audStsCd)){
			result.setSuccess(BaseConstant.IS_YESNO_NO);
			result.setInfo(SysLogConstant.LOG_CMM_DATA_PK_IS_EMPTY);
			BaseLogUtils.info(logger, "modifySpStatus", "修改上牌验证状态,参数不完整！", CurrentThreadContext.getCurrentUserName());
			return result;
		}
		try {
			//增加调用中交GPS平台提供的车辆入网DUBBO服务进行车辆入网
			//id为PRJ_PRD_LIC_INFO的id
			PrjPrdLicInfoVO prdLicInfoVO = prjPrdLicInfoService.selectById(Long.valueOf(id));
			prjPrdVehInfoService.submitChinaGPS(prdLicInfoVO);

			PrjPrdLicInfoVO prjPrdLicInfoVO = new PrjPrdLicInfoVO();
			prjPrdLicInfoVO.setId(Long.valueOf(id));
			prjPrdLicInfoVO.setAudStsCd(audStsCd);
			if (StringUtils.isNotEmpty(prjId)) {
				prjPrdLicInfoVO.setPrjId(Long.valueOf(prjId));
			}
			boolean success = this.prjPrdLicInfoService.modify(prjPrdLicInfoVO);
			if (!success) {
				result.setSuccess(BaseConstant.IS_YESNO_NO);
				result.setInfo(SysLogConstant.LOG_CMM_DELETE_FAIL);
			}
			BaseLogUtils.info(logger, "modifySpStatus", "修改上牌验证状态,ID:" + id + ".audStsCd:" + audStsCd, CurrentThreadContext.getCurrentUserName());
			BaseLogUtils.newLogger("实时发送设备信息开始入参dtlId=" + id).info();
			boolean b = this.deviceInfoApiService.sendDeviceInfo(Long.valueOf(id));
			BaseLogUtils.newLogger("实时发送设备信息返回结果dtlId=" + id + "b=" + b).info();
		}catch (BaseException ex) {
			result.setSuccess(BaseConstant.IS_YESNO_NO);
			result.setInfo(ex.getMessage());
			BaseLogUtils.info(logger, "modifySpStatus", "修改上牌验证状态失败,ID:"+id+".audStsCd:"+audStsCd+".ERROR:"+ex.getMessage(), CurrentThreadContext.getCurrentUserName());
		}catch (Exception ex) {
			result.setSuccess(BaseConstant.IS_YESNO_NO);
			result.setInfo(SysLogConstant.LOG_CMM_SYS_ERROR);
			BaseLogUtils.error(logger, "modifySpStatus", "修改上牌验证状态失败,系统错误.ID:"+id+".audStsCd:"+audStsCd+".ERROR:"+ex.getMessage(), CurrentThreadContext.getCurrentUserName());
		}

		return result;
	}
	/**
	 * 修改抵押验证状态
	 * @param request
	 * @param response
	 * @return
	 * @throws BaseException
	 */
	@RequestMapping(value = "/modifyDyStatus.do", method = {RequestMethod.POST })
	@ResponseBody
	public DataResultVO modifyDyStatus(HttpServletRequest request, HttpServletResponse response) throws BaseException {
		/*String guarStsCd = request.getParameter("guarStsCd");*/
		String id = request.getParameter("id");
		String mtgWayCd = request.getParameter("mtgWayCd");
		//换车-dtl无prjId
		String prjId = request.getParameter("prjId");
		DataResultVO result = new DataResultVO(BaseConstant.IS_YESNO_YES, SysLogConstant.LOG_CMM_OPERATE_SUCC);
		if(StringUtils.isEmpty(id) || StringUtils.isEmpty(mtgWayCd)){
			result.setSuccess(BaseConstant.IS_YESNO_NO);
			result.setInfo(SysLogConstant.LOG_CMM_DATA_PK_IS_EMPTY);
			BaseLogUtils.info(logger, "modifyDyStatus", "修改抵押验证状态,参数不完整！", CurrentThreadContext.getCurrentUserName());
			return result;
		}

		try {
			//校验上传资料是否已验证
			PrjPrdDtlVO prjPrdDtlVO = prjPrdDtlService.selectById(Long.valueOf(id));
			if(null == prjPrdDtlVO){
				BaseLogUtils.newLogger("通过抵押信息查询不到对应的产品信息").error(LogExceptionEnum.API_CODE_0102);
				result.setSuccess(BaseConstant.IS_YESNO_NO);
				result.setInfo("根据抵押信息查询不到对应的产品信息");
				return result;
			}
			Long projectId = prjPrdDtlVO.getPrjId();
			PrjBscInfoVO prjBscInfoVO = prjBscInfoService.selectById(projectId);
			if(null != prjBscInfoVO && PrjBscInfoConstant.PRJ_INS_CODE_WEBANK.equals(prjBscInfoVO.getInsCode())){
				CapPayInfoQueryCondition qc = new CapPayInfoQueryCondition();
				qc.setPrjPrdDtlId(Long.valueOf(id));
				List<CapPayMaterialVo> capPayMaterialVoList = prjPrdLicInfoService.searchMateList(qc,"mtg");
				BaseLogUtils.newLogger("修改抵押验证状态，抵押资料信息={}",JSON.toJSONString(capPayMaterialVoList)).info();
				if(CollectionUtils.isNotEmpty(capPayMaterialVoList)){
					for(CapPayMaterialVo capPayMaterialVo:capPayMaterialVoList){
						// 0 :未验证 1：已验证 2：验证不通过
						if(!"1".equals(capPayMaterialVo.getAudStsCd())){
                            BaseLogUtils.newLogger("抵押资料必须验证通过").error(LogExceptionEnum.API_CODE_0102);
                            result.setSuccess(BaseConstant.IS_YESNO_NO);
                            result.setInfo("抵押资料必须验证通过！");
                            return result;
						}
					}
				}
			}
            PrjPrdMtgVO prjPrdMtgVO = new PrjPrdMtgVO();
            prjPrdMtgVO.setId(Long.valueOf(id));
            if ("2".equals(mtgWayCd)){//当抵押方式为无法抵押，抵押状态修改为无法抵押
                prjPrdMtgVO.setGuarStsCd(PrjPrdMtgConstant.CODE_GUAR_STS_CD_FOR_MTG);
            }else {//当抵押方式为正常抵押、资方机构、上户自有公司时，抵押状态修改为已抵押
                prjPrdMtgVO.setGuarStsCd(PrjPrdMtgConstant.CODE_GUAR_STS_CD_MTG);
            }
			if (StringUtils.isNotEmpty(prjId)) {
				prjPrdMtgVO.setPrjId(Long.valueOf(prjId));
			}
            boolean success = this.prjPrdMtgService.modify(prjPrdMtgVO);
            if(!success){
                result.setSuccess(BaseConstant.IS_YESNO_NO);
                result.setInfo(SysLogConstant.LOG_CMM_DELETE_FAIL);
            }
            BaseLogUtils.info(logger, "modifyDyStatus", "修改抵押验证状态,ID:"+id+".mtgWayCd:"+mtgWayCd, CurrentThreadContext.getCurrentUserName());


		}catch (BaseException ex) {
			result.setSuccess(BaseConstant.IS_YESNO_NO);
			result.setInfo(ex.getMessage());
			BaseLogUtils.info(logger, "modifyDyStatus", "修改抵押验证状态失败,ID:"+id+".mtgWayCd:"+mtgWayCd+".ERROR:"+ex.getMessage(), CurrentThreadContext.getCurrentUserName());
		}catch (Exception ex) {
			result.setSuccess(BaseConstant.IS_YESNO_NO);
			result.setInfo(SysLogConstant.LOG_CMM_SYS_ERROR);
			BaseLogUtils.error(logger, "modifyDyStatus", "修改抵押验证状态失败,系统错误.ID:"+id+".mtgWayCd:"+mtgWayCd+".ERROR:"+ex.getMessage(), CurrentThreadContext.getCurrentUserName());
		}
		
		return result;
	}
	
	/**
	 * 城配流程 - 信审节点 付款审核 
	 */
	@RequestMapping(value = "/toPayInfoList.do", method = { RequestMethod.GET, RequestMethod.POST })
	public ModelAndView toPayInfoList(HttpServletRequest request, HttpServletResponse response) {
		String prjId = request.getParameter("prjId");//业务主键(项目ID)
		String proIntId = request.getParameter("processInstanceId");//流程实例ID
		String taskId = request.getParameter("taskId");//任务ID
		String taskDefKey = request.getParameter("taskDefKey");//任务KEY
		String taskNm = request.getParameter("taskNm");//任务名称
		String isGpsNode = request.getParameter("isGpsNode");
		ModelAndView view = new ModelAndView();
		
		if(StringUtils.isEmpty(prjId))throw new BaseException(BaseExceptionConstant.BASE_EXCEPTION_CODE_600, "流程中业务主键为空.");
		PrjBscInfoVO prjBscInfoVO = this.prjBscInfoService.selectById(Long.valueOf(prjId));

		try {
			if(true){
				if(null!=prjBscInfoVO && !PrjBscInfoConstant.PRJ_TYP_CD_CDDYW.equals(prjBscInfoVO.getPrjTypCd())){
					//查询是否有付款信息 如果没有生成
					CapPayInfoQueryCondition CPIQC = new CapPayInfoQueryCondition();
					CPIQC.setPrjId(Long.valueOf(prjId));
					List<CapPayInfoVO> CPIVOList = this.capPayInfoService.searchList(CPIQC);
					BaseLogUtils.info(logger, "toPayInfoList", "查询CapPayInfoVO=" + prjId + "CPIVOList=" + JSON.toJSONString(CPIVOList));
					if(CollectionUtils.isEmpty(CPIVOList)){
						/**
						 * 根据项目ID,流程实例ID  生成付款信息/付款信息对应流程历史/修改付款信息审核状态为:放款中
						 */
						FlowCompleteParamsDTO flowCompleteParamsDTO = new FlowCompleteParamsDTO();
						flowCompleteParamsDTO.setBusinessKey(Long.valueOf(prjId));
						flowCompleteParamsDTO.setCrtUsrId(CurrentThreadContext.getCurrentUserId());
						flowCompleteParamsDTO.setSysCd(CurrentThreadContext.getCurrentSysCd());
						flowCompleteParamsDTO.setTaskId(taskId);
						flowCompleteParamsDTO.setTaskDefKey(taskDefKey);
						flowCompleteParamsDTO.setProcInstId(proIntId);
						flowCompleteParamsDTO.setTaskDefNm(taskNm);
						if(!this.cacheService.keyExists("addCapPayInfo"+prjId)){
							BaseLogUtils.info(logger, "toPayInfoList", "=进入生产付款数据="+prjId, CurrentThreadContext.getCurrentUserName());
							this.cacheService.add("addCapPayInfo"+prjId, prjId, 120);
							BaseLogUtils.info(logger, "toPayInfoList", "进入生产付款数据入参prjId="+prjId + JSON.toJSONString(flowCompleteParamsDTO));
							boolean result = this.capPayInfoService.addCapPayInfoAndFlowSH(flowCompleteParamsDTO);
							BaseLogUtils.info(logger, "toPayInfoList", "进入生产付款结果数据="+prjId + result);
							if(this.cacheService.keyExists("addCapPayInfo"+prjId)){
								this.cacheService.delete("addCapPayInfo"+prjId);
							}
							if(!result){
								throw new BaseException(BaseExceptionConstant.BASE_EXCEPTION_CODE_601, "生成付款数据失败.");
							}
						}
					}
				}
				
			}
			/*//查询放款数据数目  如果只有一条直接跳转详情 否则跳转列表
			CapPayInfoQueryCondition CPIQC = new CapPayInfoQueryCondition();
			CPIQC.setPrjId(Long.valueOf(prjId));
			CPIQC.setPayTypCd(CapPayInfoConstant.CODE_PAY_TYP_CD_2);
			List<CapPayInfoVO> CPIVOList = this.capPayInfoService.searchList(CPIQC);
			if(CollectionUtils.isNotEmpty(CPIVOList) && CPIVOList.size()==1){
				view = new ModelAndView("capital/flowAdditionalInfo/payFlowAdditionalPage");
				
				CapPayInfoVO capPayInfoVO = CPIVOList.get(0);
					
				Long capPayId = capPayInfoVO.getId();
				view.addObject("capPayId", capPayId);
				
				if(StringUtils.isEmpty(capPayId))throw new BaseException(BaseExceptionConstant.BASE_EXCEPTION_CODE_600, "流程中业务主键为空.");
				
				BaseLogUtils.info(logger, "toAdditionalInfoPage", "===查询租赁物数量、历史付款次数、上传资料数量Start===capPayId:"+capPayId+",capPayInfoVO:"+JSON.toJSONString(capPayInfoVO), CurrentThreadContext.getCurrentUserName());
				//Tab头 查询付款信息中租赁物数量、历史付款次数、上传资料数量
				capPayInfoVO=this.capPayInfoService.getPayInfoCount(capPayInfoVO);
				BaseLogUtils.info(logger, "toAdditionalInfoPage", "===查询租赁物数量、历史付款次数、上传资料数量End===capPayId:"+capPayId+",capPayInfoVO:"+JSON.toJSONString(capPayInfoVO), CurrentThreadContext.getCurrentUserName());
				view.addObject("capPayInfoVO",capPayInfoVO);
				//查询代扣卡验证状态
				String audStsCdNm = "";
				CstBankQueryCondition cstBankQC = new CstBankQueryCondition();
				List<Long> cstIdList = new ArrayList<Long>();
				cstIdList.add(capPayInfoVO.getCstId());
				cstBankQC.setCstIdList(cstIdList);
				cstBankQC.setIsDeduct(BaseConstant.IS_YESNO_YES);
				cstBankQC.setSysCd(CurrentThreadContext.getCurrentSysCd());
				cstBankQC.setOrgCd(CurrentThreadContext.getCurrentOrgCd());
				
				BaseLogUtils.info(logger, "toAdditionalInfoPage", "===根据查询条件获取客户帐号信息Start===cstId:"+capPayInfoVO.getCstId()+",cstBankQC:"+JSON.toJSONString(cstBankQC), CurrentThreadContext.getCurrentUserName());
				List<CstBankDTO> list = this.customerQueryApiService.searchCstBankWithCstInfoList(cstBankQC);
				BaseLogUtils.info(logger, "toAdditionalInfoPage", "===根据查询条件获取客户帐号信息End===cstId:"+capPayInfoVO.getCstId()+",list:"+JSON.toJSONString(list), CurrentThreadContext.getCurrentUserName());
				if(CollectionUtils.isNotEmpty(list)){
					CstBankDTO cstBankDTO = list.get(0);
					if(null!=cstBankDTO){
						audStsCdNm = cstBankDTO.getAudStsCdNm();
					}
				}
				view.addObject("audStsCdNm", audStsCdNm);
				
				//收款方类型
				List<KeyValueVO> payeeTypCdList = this.capPayInfoService.getPayeeTypCdList();
				view.addObject("payeeTypCdList",JSON.toJSONString(payeeTypCdList));
				//款项
				List<KeyValueVO> fundTypCdList=this.capPayInfoService.getFundTypCdList();
				view.addObject("fundTypCdList",JSON.toJSONString(fundTypCdList));
				//付款方式
				List<KeyValueVO> payWayCdList=this.capPayInfoService.getPayWayCdList();
				view.addObject("payWayCdList",JSON.toJSONString(payWayCdList));
				//账户类型
				List<KeyValueVO> bkAccTypCdList=this.capPayInfoService.getBkAccTypCdList();
				view.addObject("bkAccTypCdList",JSON.toJSONString(bkAccTypCdList));
				//是否
				List<KeyValueVO> yesOrNOList = this.capPayInfoService.searchYesOrNOList();
				view.addObject("yesOrNOList", yesOrNOList);
				
				//查询收款方信息
				CapPayeeInfoQueryCondition payeeInfoQueryCondition=new CapPayeeInfoQueryCondition();
				payeeInfoQueryCondition.setPayId(Long.valueOf(capPayId));
				BaseLogUtils.info(logger, "toAdditionalInfoPage", "===查询收款方信息Start===capPayId:"+capPayId, CurrentThreadContext.getCurrentUserName());
				List<CapPayeeInfoVO> payeeVOList= capPayeeInfoService.searchList(payeeInfoQueryCondition);
				BaseLogUtils.info(logger, "toAdditionalInfoPage", "===查询收款方信息End===capPayId:"+capPayId+",payeeVOList:"+JSON.toJSONString(payeeVOList), CurrentThreadContext.getCurrentUserName());
				if(CollectionUtils.isNotEmpty(payeeVOList)){//现只有一个收款方
				    view.addObject("capPayeeInfoVO",payeeVOList.get(0));
				    CapPayeeInfoVO capPayeeInfoVO = payeeVOList.get(0); 
				    //先查询
				    BaseLogUtils.info(logger, "toAdditionalInfoPage", "===根据放款单流水号查询支付单信息Start===capPayeeId:"+capPayeeInfoVO.getId(), CurrentThreadContext.getCurrentUserName());
					InfBfsPayDTO bfsPayDTO = this.bFSApiService.selectByFlsNum(Long.valueOf(capPayeeInfoVO.getId()));
					BaseLogUtils.info(logger, "toAdditionalInfoPage", "===根据放款单流水号查询支付单信息End===capPayeeId:"+capPayeeInfoVO.getId()+",bfsPayDTO:"+JSON.toJSONString(bfsPayDTO), CurrentThreadContext.getCurrentUserName());
					//存在且状态不是发送失败也不是付款失败  则说明网银已经推送 页面控制付款方式不可修改
					if(null!=bfsPayDTO 
							&& !InterfaceConstants.BfsPayStatus.payFailure.key().equals(bfsPayDTO.getStatus())
							&& !InterfaceConstants.BfsPayStatus.sendFailure.key().equals(bfsPayDTO.getStatus())){
						view.addObject("isAllowMdfPayTypCd", "0");
					}
				}
				//接收流程定义URL 传过来的控制参数
				String hjzxFlag = request.getParameter("hjzxFlag");//呼叫中心:编辑是否团单:hjzxFlag 放款合同意见
				if(StringUtils.isEmpty(hjzxFlag)){
					hjzxFlag = "0";
				}
				String ctrlKey = request.getParameter("ctrlKey");//控制放款资料页签的操作 "3":不可操作  "2":验证放款资料  "1":上传/删除
				if(StringUtils.isEmpty(ctrlKey)){
					ctrlKey = "3";
				}
				String xsFlag = request.getParameter("xsFlag");//信审审核 放款抵押意见
				if(StringUtils.isEmpty(xsFlag)){
					xsFlag = "0";
				}
				String kjshFlag = request.getParameter("kjshFlag");//会计审核:核算实际付款金额(付款方)kjshFlag
				if(StringUtils.isEmpty(kjshFlag)){
					kjshFlag = "0";
				}
				String zjlFlag = request.getParameter("zjlFlag");//呈报人:可编辑收款方账号:zjlFlag=1(收款方)
				if(StringUtils.isEmpty(zjlFlag)){
					zjlFlag = "0";
				}
				String btnFlag = request.getParameter("btnFlag");//保存按钮显示 btnFlag=1
				if(StringUtils.isEmpty(btnFlag)){
					btnFlag = "0";
				}
				String zjbFlag = request.getParameter("zjbFlag");//资金部:可编辑付款方式:zjbFlag=1(收款方)
				if(StringUtils.isEmpty(zjbFlag)){
					zjbFlag = "0";
				}
				String cnFlag = request.getParameter("cnFlag"); //出纳:可编辑时间,金额:cnFlag=1(非网银)
				if(StringUtils.isEmpty(cnFlag)){
					cnFlag = "0";
				}
				String spFlag = request.getParameter("spFlag"); //上牌
				if(StringUtils.isEmpty(spFlag)){
					spFlag = "0";
				}
				String isExistSp = "";
				String spState = "0";
				Long prjPrdDtlId = capPayInfoVO.getPrjPrdDtlId();
				if(StringUtils.isNotEmpty(prjPrdDtlId)){
					//查询上牌信息
					BaseLogUtils.info(logger, "toAdditionalInfoPage", "===查询上牌信息Start===prjPrdDtlId:"+prjPrdDtlId, CurrentThreadContext.getCurrentUserName());
					PrjPrdLicInfoVO prjPrdLicInfoVO = this.prjPrdLicInfoService.selectById(prjPrdDtlId);
					BaseLogUtils.info(logger, "toAdditionalInfoPage", "===查询上牌信息End===prjPrdDtlId:"+prjPrdDtlId+",prjPrdLicInfoVO:"+JSON.toJSONString(prjPrdLicInfoVO), CurrentThreadContext.getCurrentUserName());
					if(null==prjPrdLicInfoVO){
						isExistSp = "0";
					}else{
						isExistSp = "1";
					}
					if(null!=prjPrdLicInfoVO && FlowConstant.FLOW_CHECK_STATE_PASS.equals(prjPrdLicInfoVO.getAudStsCd())){
						spState = "1";
					}
				}
				view.addObject("spState", spState);
				view.addObject("isExistSp", isExistSp);
				String dyFlag = request.getParameter("dyFlag"); //抵押
				if(StringUtils.isNotEmpty(dyFlag)){
					dyFlag = dyFlag.replace("\'", "");
				}else{
					dyFlag = "0";
				}
				//2017-3-31 String escFlag = "0";
				String escFlag = "1";
				String isExistDy = "";
				String dyState = "0";
				if(StringUtils.isNotEmpty(prjPrdDtlId)){
					//查询抵押信息
					BaseLogUtils.info(logger, "toAdditionalInfoPage", "===查询抵押信息Start===prjPrdDtlId:"+prjPrdDtlId, CurrentThreadContext.getCurrentUserName());
					PrjPrdMtgVO prjPrdMtgVO = this.prjPrdMtgService.selectById(prjPrdDtlId);
					BaseLogUtils.info(logger, "toAdditionalInfoPage", "===查询抵押信息End===prjPrdDtlId:"+prjPrdDtlId+",prjPrdMtgVO:"+JSON.toJSONString(prjPrdMtgVO), CurrentThreadContext.getCurrentUserName());
					if(null==prjPrdMtgVO){
						isExistDy = "0";
					}else{
						isExistDy = "1";
					}
					if(null!=prjPrdMtgVO && PrjPrdMtgConstant.CODE_GUAR_STS_CD_MTG.equals(prjPrdMtgVO.getGuarStsCd())){
						dyState = "1";
					}
				}
				view.addObject("dyState", dyState);
				2017-3-31 Long prjId = capPayInfoVO.getPrjId();
				if(StringUtils.isNotEmpty(prjId)){
					PrjBscInfoVO prjBscInfoVO = this.prjBscInfoService.selectById(prjId);
					if(null!=prjBscInfoVO && PrjBscInfoConstant.PRJ_TYP_CD_ESC.equals(prjBscInfoVO.getPrjTypCd())){
						if(null!=prjBscInfoVO){
				    		escFlag = "1";
				        	if(StringUtils.isNotEmpty(prjPrdDtlId)){
				        		//查询抵押信息
				        		PrjPrdMtgVO prjPrdMtgVO = this.prjPrdMtgService.selectById(prjPrdDtlId);
				        		if(null==prjPrdMtgVO){
				        			isExistDy = "0";
				        		}else{
				        			isExistDy = "1";
				        		}
				        	}
				    	}
					}
				}
				view.addObject("escFlag", escFlag);
				view.addObject("dyFlag", dyFlag);
				view.addObject("isExistDy", isExistDy);
				
				view.addObject("btnFlag", btnFlag);
				view.addObject("hjzxFlag", hjzxFlag);
				view.addObject("kjshFlag", kjshFlag);
				view.addObject("zjlFlag", zjlFlag);
				view.addObject("zjbFlag", zjbFlag);
				view.addObject("cnFlag", cnFlag);
				view.addObject("xsFlag", xsFlag);
				view.addObject("spFlag", spFlag);
				view.addObject("ctrlKey", ctrlKey);
				
				String isCPCW = request.getParameter("isCPCW");
				view.addObject("isCPCW", isCPCW);
				String isNeedCallback = request.getParameter("isNeedCallback");
				view.addObject("isNeedCallback", isNeedCallback);
				String bhFlag = request.getParameter("bhFlag");//是否可以维护驳回意见
				view.addObject("bhFlag", bhFlag);
				
				String checkSp = request.getParameter("checkSp");//是否有验证上牌信息权限
				view.addObject("checkSp", checkSp);
				String checkDy = request.getParameter("checkDy");//是否有验证抵押信息权限
				view.addObject("checkDy", checkDy);
				
				//by YAOXIURONG 17-9-1
				String QZTX = request.getParameter("QZTX");//起租提醒节点标识
				view.addObject("QZTX", QZTX);
				
				//by YAOXIURONG 17-9-7
				String addReturnInfo = request.getParameter("addReturnInfo");//是否可以保存实付时间和金额(网银实际付款成功确没有回传时间和金额)
				view.addObject("addReturnInfo", addReturnInfo);
				
				String confirmPay = request.getParameter("confirmPay");//付款审核
				view.addObject("confirmPay", confirmPay);
			}else{
			}*/
			view = new ModelAndView("capital/flowAdditionalInfo/payFlowAdditionalList");
			
		} catch (BaseException e) {
			if(this.cacheService.keyExists("addCapPayInfo"+prjId)){
				this.cacheService.delete("addCapPayInfo"+prjId);
			}
			e.printStackTrace();
			BaseLogUtils.info(logger, "addCapPayInfoAndFlowSH", "===生成付款数据异常===INFO:"+e.getMessage());
			throw e;
		} catch (Exception e) {
			if(this.cacheService.keyExists("addCapPayInfo"+prjId)){
				this.cacheService.delete("addCapPayInfo"+prjId);
			}
			e.printStackTrace();
			BaseLogUtils.error(logger, "addCapPayInfoAndFlowSH", "===生成付款数据异常===ERROR:"+e.getMessage());
			throw new BaseException(BaseExceptionConstant.BASE_EXCEPTION_CODE_601, "生成付款数据系统错误.");
		}
		view.addObject("prjTypeCd", prjBscInfoVO.getPrjTypCd() == null ?  "" : prjBscInfoVO.getPrjTypCd());
		view.addObject("prjId", prjId);
		view.addObject("proIntId", proIntId);
		view.addObject("taskId", taskId);
		view.addObject("taskDefKey", taskDefKey);
		view.addObject("taskNm", taskNm);
		
		String confirmPay = request.getParameter("confirmPay");//付款审核
		view.addObject("confirmPay", confirmPay);
		String ctrlKey = request.getParameter("ctrlKey");
		view.addObject("ctrlKey", ctrlKey);
		
		String version = request.getParameter("version");
		view.addObject("version", version);
		String isAuditNode = request.getParameter("isAuditNode");
		view.addObject("isAuditNode", isAuditNode);
		view.addObject("isGpsNode",isGpsNode);
		return view;
	}
	
	/**
	 * 第三方工行城配上装评审流程流程 - 信审节点 付款审核 - 临时过渡使用
	 */
	@RequestMapping(value = "/toTempPayInfoList.do", method = { RequestMethod.GET, RequestMethod.POST })
	public ModelAndView toTempPayInfoList(HttpServletRequest request, HttpServletResponse response) {
		String prjId = request.getParameter("prjId");//业务主键(项目ID)
		String proIntId = request.getParameter("processInstanceId");//流程实例ID
		String taskId = request.getParameter("taskId");//任务ID
		String taskDefKey = request.getParameter("taskDefKey");//任务KEY
		String taskNm = request.getParameter("taskNm");//任务名称
		ModelAndView view = new ModelAndView();
		
		if(StringUtils.isEmpty(prjId))throw new BaseException(BaseExceptionConstant.BASE_EXCEPTION_CODE_600, "流程中业务主键为空.");
		try {
			if(true){
				//查询是否有付款信息 如果没有生成
				CapPayInfoQueryCondition CPIQC = new CapPayInfoQueryCondition();
				CPIQC.setPrjId(Long.valueOf(prjId));
				List<CapPayInfoVO> CPIVOList = this.capPayInfoService.searchList(CPIQC);
				if(CollectionUtils.isEmpty(CPIVOList)){
					/**
					 * 根据项目ID,流程实例ID  生成付款信息/付款信息对应流程历史/修改付款信息审核状态为:放款中
					 */
					FlowCompleteParamsDTO flowCompleteParamsDTO = new FlowCompleteParamsDTO();
					flowCompleteParamsDTO.setBusinessKey(Long.valueOf(prjId));
					flowCompleteParamsDTO.setCrtUsrId(CurrentThreadContext.getCurrentUserId());
					flowCompleteParamsDTO.setSysCd(CurrentThreadContext.getCurrentSysCd());
					flowCompleteParamsDTO.setTaskId(taskId);
					flowCompleteParamsDTO.setTaskDefKey(taskDefKey);
					flowCompleteParamsDTO.setProcInstId(proIntId);
					flowCompleteParamsDTO.setTaskDefNm(taskNm);
					boolean result = this.capPayInfoService.addCapPayInfoAndFlowSH(flowCompleteParamsDTO);
					if(!result){
						throw new BaseException(BaseExceptionConstant.BASE_EXCEPTION_CODE_601, "生成付款数据失败.");
					}
				}
			}
			view = new ModelAndView("capital/flowAdditionalInfo/tempPayFlowAdditionalList");
			
		} catch (BaseException e) {
			e.printStackTrace();
			BaseLogUtils.info(logger, "addCapPayInfoAndFlowSH", "===生成付款数据异常===INFO:"+e.getMessage());
			throw e;
		} catch (Exception e) {
			e.printStackTrace();
			BaseLogUtils.error(logger, "addCapPayInfoAndFlowSH", "===生成付款数据异常===ERROR:"+e.getMessage());
			throw new BaseException(BaseExceptionConstant.BASE_EXCEPTION_CODE_601, "生成付款数据系统错误.");
		}
		
		view.addObject("prjId", prjId);
		view.addObject("proIntId", proIntId);
		view.addObject("taskId", taskId);
		view.addObject("taskDefKey", taskDefKey);
		view.addObject("taskNm", taskNm);
		
		String confirmPay = request.getParameter("confirmPay");//付款审核
		view.addObject("confirmPay", confirmPay);
		String ctrlKey = request.getParameter("ctrlKey");
		view.addObject("ctrlKey", ctrlKey);
		
		String version = request.getParameter("version");
		view.addObject("version", version);
		return view;
	}
	/**
	 * 第三方工行城配上装评审流程流程 附加信息页面 - 临时过渡使用
	 */
	@RequestMapping(value = "/toTempAdditionalInfoList.do", method = { RequestMethod.GET, RequestMethod.POST })
	public ModelAndView toTempAdditionalInfoList(HttpServletRequest request, HttpServletResponse response) {
		String isAuditNode = request.getParameter("isAuditNode");//是否信审节点标识
		
		String prjId = request.getParameter("prjId");//业务主键(项目ID)
		String proIntId = request.getParameter("processInstanceId");//流程实例ID
		String taskId = request.getParameter("taskId");//任务ID
		String taskDefKey = request.getParameter("taskDefKey");//任务KEY
		String taskNm = request.getParameter("taskNm");//任务名称
		ModelAndView view = new ModelAndView("capital/flowAdditionalInfo/tempPayFlowAdditionalList");
		view.addObject("prjId", prjId);
		view.addObject("proIntId", proIntId);
		view.addObject("taskId", taskId);
		view.addObject("taskDefKey", taskDefKey);
		view.addObject("taskNm", taskNm);
		
		String saveDueDate = request.getParameter("saveDueDate");//是否可以设置(第一期)还款日
		view.addObject("saveDueDate", saveDueDate);
		
		view.addObject("isAuditNode", isAuditNode);
		
		//version:2 第二个版本页面处理逻辑    version:3 第三方资管工行卡贷[工行放款确认/驻点人员添加联名卡]跳转capPayInfoModify页面
		String version = request.getParameter("version");
		view.addObject("version", version);
		
		//2018-2-22 by yaoxiurong 第三方资管工行卡贷
		String accCtrl = request.getParameter("accCtrl");
		String isAddPayerStatusCd = request.getParameter("isAddPayerStatusCd");
		String isAddBank = request.getParameter("isAddBank");
		view.addObject("accCtrl", accCtrl);
		view.addObject("isAddPayerStatusCd", isAddPayerStatusCd);
		view.addObject("isAddBank", isAddBank);
		
		if(StringUtils.isEmpty(prjId))throw new BaseException(BaseExceptionConstant.BASE_EXCEPTION_CODE_600, "流程中业务主键为空.");
		
		//接收流程定义URL 传过来的控制参数
		String hjzxFlag = request.getParameter("hjzxFlag");//呼叫中心:编辑是否团单:hjzxFlag 放款合同意见
		if(StringUtils.isEmpty(hjzxFlag)){
			hjzxFlag = "0";
		}
		String ctrlKey = request.getParameter("ctrlKey");//控制放款资料页签的操作 "3":不可操作  "2":验证放款资料  "1":上传/删除
		if(StringUtils.isEmpty(ctrlKey)){
			ctrlKey = "3";
		}
		String xsFlag = request.getParameter("xsFlag");//信审审核 放款抵押意见
		if(StringUtils.isEmpty(xsFlag)){
			xsFlag = "0";
		}
		String kjshFlag = request.getParameter("kjshFlag");//会计审核:核算实际付款金额(付款方)kjshFlag
		if(StringUtils.isEmpty(kjshFlag)){
			kjshFlag = "0";
		}
		String zjlFlag = request.getParameter("zjlFlag");//呈报人:可编辑收款方账号:zjlFlag=1(收款方)
		if(StringUtils.isEmpty(zjlFlag)){
			zjlFlag = "0";
		}
		String btnFlag = request.getParameter("btnFlag");//保存按钮显示 btnFlag=1
		if(StringUtils.isEmpty(btnFlag)){
			btnFlag = "0";
		}
		String zjbFlag = request.getParameter("zjbFlag");//资金部:可编辑付款方式:zjbFlag=1(收款方)
		if(StringUtils.isEmpty(zjbFlag)){
			zjbFlag = "0";
		}
		String cnFlag = request.getParameter("cnFlag"); //出纳:可编辑时间,金额:cnFlag=1(非网银)
		if(StringUtils.isEmpty(cnFlag)){
			cnFlag = "0";
		}
		String spFlag = request.getParameter("spFlag"); //上牌
		if(StringUtils.isEmpty(spFlag)){
			spFlag = "0";
		}
		String dyFlag = request.getParameter("dyFlag"); //抵押
		if(StringUtils.isEmpty(dyFlag)){
        	dyFlag = "0";
        }
		
		String isCPCW = request.getParameter("isCPCW"); //城配财务付款
		if(StringUtils.isEmpty(isCPCW)){
			isCPCW = "0";
		}
		
		/*String payStsCd = request.getParameter("payStsCd");
		view.addObject("payStsCd", payStsCd);*/
		
		view.addObject("isCPCW", isCPCW);
		view.addObject("btnFlag", btnFlag);
		view.addObject("hjzxFlag", hjzxFlag);
		view.addObject("kjshFlag", kjshFlag);
		view.addObject("zjlFlag", zjlFlag);
		view.addObject("zjbFlag", zjbFlag);
		view.addObject("cnFlag", cnFlag);
		view.addObject("xsFlag", xsFlag);
		view.addObject("spFlag", spFlag);
		view.addObject("dyFlag", dyFlag);
		view.addObject("ctrlKey", ctrlKey);
		
		String checkSp = request.getParameter("checkSp");//是否有验证上牌信息权限
        view.addObject("checkSp", checkSp);
        String checkDy = request.getParameter("checkDy");//是否有验证抵押信息权限
        view.addObject("checkDy", checkDy);
        
        //by YAOXIURONG 17-9-1
        String QZTX = request.getParameter("QZTX");//起租提醒节点标识
        view.addObject("QZTX", QZTX);
        
        //by YAOXIURONG 17-9-7
        String addReturnInfo = request.getParameter("addReturnInfo");//是否可以保存实付时间和金额(网银实际付款成功确没有回传时间和金额)
        view.addObject("addReturnInfo", addReturnInfo);
        
        
        String addReturnInfo_rebate = request.getParameter("addReturnInfo_rebate");//是否可以保存【返利账户】实付时间和金额
        view.addObject("addReturnInfo_rebate", addReturnInfo_rebate);
        String modifyRebateBank = request.getParameter("modifyRebateBank");//是否可以修改【返利账户】账户信息
        view.addObject("modifyRebateBank", modifyRebateBank);
        
		return view;
	}
	
	/**
	 * 根据第一期还款日生成(工行支付表+上装支付表)每期还款日
	 */
	@RequestMapping(value = "/addDueDate.do", method = { RequestMethod.POST })
	@ResponseBody
	public Object addDueDate(HttpServletRequest request, HttpServletResponse response) throws BaseException {
		DataResultVO result = new DataResultVO(BaseConstant.IS_YESNO_YES,SysLogConstant.LOG_CMM_OPERATE_SUCC);
		String prjId = request.getParameter("prjId");
		String buOrgCd = request.getParameter("buOrgCd");
		//String paySchId = request.getParameter("paySchId");
		String dueDate = request.getParameter("dueDate");
		if(StringUtils.isEmpty(prjId)){
			throw new BaseException(BaseExceptionConstant.BASE_EXCEPTION_CODE_600, "项目ID不能为空.");
		}
		if(StringUtils.isEmpty(buOrgCd)){
			throw new BaseException(BaseExceptionConstant.BASE_EXCEPTION_CODE_600, "事业部代码不能为空.");
		}
		if(StringUtils.isEmpty(dueDate)){
			throw new BaseException(BaseExceptionConstant.BASE_EXCEPTION_CODE_600, "第一期还款日不能为空.");
		}
		try {
			//查询项目支付表信息
			PrjPrdPaySchMQueryCondition pppsmQC = new PrjPrdPaySchMQueryCondition();
			pppsmQC.setPrjId(Long.valueOf(prjId));
            pppsmQC.setPaySchTypCd(PrjPrdPaySchMConstant.PAY_SCH_TYP_CD_WS);
			List<PrjPrdPaySchMVO> prjPrdPaySchMVOList = this.prjPrdPaySchMService.searchList(pppsmQC);
			if(CollectionUtils.isNotEmpty(prjPrdPaySchMVOList)){
				for (PrjPrdPaySchMVO prjPrdPaySchMVO : prjPrdPaySchMVOList) {
					boolean modify = this.prjPrdPaySchMService.modifySetPrjPrdSchMGHPayDate(prjPrdPaySchMVO.getId(), DateUtils.formatStringToDate(dueDate, DateUtils.YYYY_MM_DD));
					if(!modify){
						result.setSuccess(BaseConstant.IS_YESNO_NO);
						result.setInfo(SysLogConstant.LOG_CMM_OPERATE_FAIL);
						BaseLogUtils.info(logger, "addDueDate", "根据第一期还款日生成每期还款日失败.prjId:"+prjId+",dueDate:"+dueDate, CurrentThreadContext.getCurrentUserName());
						return result;
					}
				}
			}
			BaseLogUtils.info(logger, "addDueDate", "根据第一期还款日生成每期还款日成功.prjId:"+prjId+",dueDate:"+dueDate, CurrentThreadContext.getCurrentUserName());
		}catch (BaseException ex) {
			result.setSuccess(BaseConstant.IS_YESNO_NO);
			result.setInfo(SysLogConstant.LOG_CMM_SYS_ERROR+ex.getMessage());
			BaseLogUtils.info(logger, "addDueDate", "根据第一期还款日生成每期还款日失败.prjId:"+prjId+",dueDate:"+dueDate+".ERROR:"+ex.getMessage(), CurrentThreadContext.getCurrentUserName());
		}catch (Exception ex) {
			result.setSuccess(BaseConstant.IS_YESNO_NO);
			result.setInfo(SysLogConstant.LOG_CMM_SYS_ERROR+ex.getMessage());
			BaseLogUtils.error(logger, "addDueDate", "根据第一期还款日生成每期还款日失败,系统错误.prjId:"+prjId+",dueDate:"+dueDate+".ERROR:"+ex.getMessage(), CurrentThreadContext.getCurrentUserName());
		}
		return result;
	}
	/**
	 * 资管江西银行手动设置起租日
	 */
	@RequestMapping(value = "/addLeaseDate.do", method = { RequestMethod.POST })
	@ResponseBody
	public Object addLeaseDate(HttpServletRequest request, HttpServletResponse response) throws BaseException {
		DataResultVO result = new DataResultVO(BaseConstant.IS_YESNO_YES,SysLogConstant.LOG_CMM_OPERATE_SUCC);
		BaseLogUtils.info(logger, "addLeaseDate", "s手动设置起租日失败.prjId:"+ CurrentThreadContext.getCurrentUserName());
		String prjId = request.getParameter("prjId");
		String buOrgCd = request.getParameter("buOrgCd");
		//String paySchId = request.getParameter("paySchId");
		String dueDate = request.getParameter("dueDate");
		BaseLogUtils.info(logger, "addLeaseDate", "设置起租日失败.prjId:"+prjId+",dueDate:"+dueDate+ CurrentThreadContext.getCurrentUserName());
		if(StringUtils.isEmpty(prjId)){
			throw new BaseException(BaseExceptionConstant.BASE_EXCEPTION_CODE_600, "项目ID不能为空.");
		}
		if(StringUtils.isEmpty(buOrgCd)){
			throw new BaseException(BaseExceptionConstant.BASE_EXCEPTION_CODE_600, "事业部代码不能为空.");
		}
		if(StringUtils.isEmpty(dueDate)){
			throw new BaseException(BaseExceptionConstant.BASE_EXCEPTION_CODE_600, "起租日不能为空.");
		}
		try {
			//查询项目支付表信息
			PrjPrdPaySchMQueryCondition pppsmQC = new PrjPrdPaySchMQueryCondition();
			pppsmQC.setPrjId(Long.valueOf(prjId));
			pppsmQC.setIsDel(BaseConstant.IS_YESNO_NO);
			pppsmQC.setIsSqBiz(BaseConstant.IS_YESNO_NO);
            pppsmQC.setPaySchTypCd(PrjPrdPaySchMConstant.PAY_SCH_TYP_CD_ZF);
			List<PrjPrdPaySchMVO> prjPrdPaySchMVOList = this.prjPrdPaySchMService.searchList(pppsmQC);
			BaseLogUtils.info(logger, "addLeaseDate", "查询数据结果"+prjPrdPaySchMVOList.size());
			if(CollectionUtils.isNotEmpty(prjPrdPaySchMVOList)){
				for (PrjPrdPaySchMVO prjPrdPaySchMVO : prjPrdPaySchMVOList) {
					//boolean modify = this.prjPrdPaySchMService.modifySetPrjPrdSchMGHPayDate(prjPrdPaySchMVO.getId(), DateUtils.formatStringToDate(dueDate, DateUtils.YYYY_MM_DD));
					prjPrdPaySchMVO.setThdPayDt(DateUtils.formatStringToDate(dueDate, DateUtils.YYYY_MM_DD));
					BaseLogUtils.info(logger, "addLeaseDate", "参数"+DateUtils.formatStringToDate(dueDate, DateUtils.YYYY_MM_DD));
					boolean modify = this.prjPrdPaySchMService.modifyEntity(prjPrdPaySchMVO);
					BaseLogUtils.info(logger, "addLeaseDate", "执行结果"+modify);
					if(!modify){
						result.setSuccess(BaseConstant.IS_YESNO_NO);
						result.setInfo(SysLogConstant.LOG_CMM_OPERATE_FAIL);
						BaseLogUtils.info(logger, "addDueDate", "设置起租日失败.prjId:"+prjId+",dueDate:"+dueDate, CurrentThreadContext.getCurrentUserName());
						return result;
					}
				}
			}
			BaseLogUtils.info(logger, "addDueDate", "设置起租日成功.prjId:"+prjId+",dueDate:"+dueDate, CurrentThreadContext.getCurrentUserName());
		}catch (BaseException ex) {
			result.setSuccess(BaseConstant.IS_YESNO_NO);
			result.setInfo(SysLogConstant.LOG_CMM_SYS_ERROR+ex.getMessage());
			BaseLogUtils.info(logger, "addDueDate", "设置起租日失败.prjId:"+prjId+",dueDate:"+dueDate+".ERROR:"+ex.getMessage(), CurrentThreadContext.getCurrentUserName());
		}catch (Exception ex) {
			result.setSuccess(BaseConstant.IS_YESNO_NO);
			result.setInfo(SysLogConstant.LOG_CMM_SYS_ERROR+ex.getMessage());
			BaseLogUtils.error(logger, "addDueDate", "设置起租日失败,系统错误.prjId:"+prjId+",dueDate:"+dueDate+".ERROR:"+ex.getMessage(), CurrentThreadContext.getCurrentUserName());
		}
		return result;
	}

	/**
	 * 青岛工行放款信息
	 * @param request
	 * @param response
	 * @return
	 * @throws BaseException
	 */
	@RequestMapping(value = "/addThdPayInfo.do", method = { RequestMethod.POST })
	@ResponseBody
	public Object addThdPayInfo(HttpServletRequest request, HttpServletResponse response) throws BaseException {
		DataResultVO result = new DataResultVO(BaseConstant.IS_YESNO_YES, SysLogConstant.LOG_CMM_OPERATE_SUCC);
		String prjId = request.getParameter("prjId");
		String capPayId = request.getParameter("capPayId");
		String payerStsCd = request.getParameter("payerStsCd");
		String thdPayAmt = request.getParameter("thdPayAmt");
		String thdPayDt = request.getParameter("thdPayDt");
		BaseLogUtils.newWebLogger("===青岛工行放款信息Start===prjId:" + prjId + ",capPayId:" + capPayId + ",payerStsCd:" + payerStsCd + ",thdPayAmt:" + thdPayAmt
								+ ",thdPayDt:" + thdPayDt).info();
		if(StringUtils.isEmpty(prjId)){
			throw new BaseException(BaseExceptionConstant.BASE_EXCEPTION_CODE_600, "项目ID不能为空.");
		}
		if(StringUtils.isEmpty(capPayId)){
			throw new BaseException(BaseExceptionConstant.BASE_EXCEPTION_CODE_600, "付款id不能为空.");
		}
		if(StringUtils.isEmpty(payerStsCd)){
			throw new BaseException(BaseExceptionConstant.BASE_EXCEPTION_CODE_600, "资方审批结果不能为空.");
		} else if ("2".equals(payerStsCd)) {
			if(StringUtils.isEmpty(thdPayAmt)){
				throw new BaseException(BaseExceptionConstant.BASE_EXCEPTION_CODE_600, "资方放款金额不能为空.");
			}
			if(StringUtils.isEmpty(thdPayDt)){
				throw new BaseException(BaseExceptionConstant.BASE_EXCEPTION_CODE_600, "资方放款时间不能为空.");
			} else {
				try {
					DateUtils.formatStringToDate(thdPayDt, DateUtils.YYYY_MM_DDHHMMSS);
				} catch (Exception e) {
					throw new BaseException(BaseExceptionConstant.BASE_EXCEPTION_CODE_600, "资方放款时间格式错误.");
				}
			}
		}

		try {
			//查询项目支付表信息
			PrjPrdPaySchMQueryCondition pppsmQC = new PrjPrdPaySchMQueryCondition();
			pppsmQC.setPrjId(Long.valueOf(prjId));
			pppsmQC.setIsDel(BaseConstant.IS_YESNO_NO);
			pppsmQC.setIsSqBiz(BaseConstant.IS_YESNO_NO);
			pppsmQC.setPaySchTypCd(PrjPrdPaySchMConstant.PAY_SCH_TYP_CD_ZF);
			BaseLogUtils.newWebLogger("===青岛工行放款信息查询支付表信息Start===prjId:" + prjId + ",capPayId:" + capPayId + ",pppsmQC:" + JSON.toJSONString(pppsmQC)).info();
			List<PrjPrdPaySchMVO> prjPrdPaySchMVOList = this.prjPrdPaySchMService.searchList(pppsmQC);
			BaseLogUtils.newWebLogger("===青岛工行放款信息查询支付表信息End===prjId:" + prjId + ",capPayId:" + capPayId + ",prjPrdPaySchMVOList:" + JSON.toJSONString(prjPrdPaySchMVOList)).info();
			if (CollectionUtils.isEmpty(prjPrdPaySchMVOList)) {
				throw new BaseException(BaseExceptionConstant.BASE_EXCEPTION_CODE_600, "未查询到支付表数据.");
			}
			for (PrjPrdPaySchMVO prjPrdPaySchMVO : prjPrdPaySchMVOList) {
				if ("2".equals(payerStsCd)) {
					prjPrdPaySchMVO.setPayerStsCd(payerStsCd);
					prjPrdPaySchMVO.setThdPayAmt(DecimalUtils.convertYuanToFen(Double.valueOf(thdPayAmt)));
					prjPrdPaySchMVO.setThdPayDt(DateUtils.formatStringToDate(thdPayDt, DateUtils.YYYY_MM_DDHHMMSS));
				}
				if ("3".equals(payerStsCd)) {
					prjPrdPaySchMVO.setPayerStsCd("3");
					prjPrdPaySchMVO.setThdPayDt(null);
					prjPrdPaySchMVO.setThdPayDtNull("#NULL");
				}
				prjPrdPaySchMVO.setMdfTm(new Date());
				prjPrdPaySchMVO.setMdfUsrId(CurrentThreadContext.getCurrentUserId());
			}
			BaseLogUtils.newWebLogger("===青岛工行放款信息修改支付表信息Start===prjId:" + prjId + ",capPayId:" + capPayId + ",prjPrdPaySchMVOList:" + JSON.toJSONString(prjPrdPaySchMVOList)).info();
			boolean upResult = this.prjPrdPaySchMApiService.batchNoTransModUpDate(PrjPrdPaySchMVOTransform.toDTOList(prjPrdPaySchMVOList));
			BaseLogUtils.newWebLogger("===青岛工行放款信息修改支付表信息End===prjId:" + prjId + ",capPayId:" + capPayId + ",upResult:" + upResult).info();
		}catch (BaseException ex) {
			result.setSuccess(BaseConstant.IS_YESNO_NO);
			result.setInfo(ex.getMessage());
			BaseLogUtils.newWebLogger("===青岛工行放款信息异常===prjId:" + prjId + ",capPayId:" + capPayId + ",ex:" + ex.getMessage()).info();
		}catch (Exception ex) {
			result.setSuccess(BaseConstant.IS_YESNO_NO);
			result.setInfo(ex.getMessage());
			BaseLogUtils.newWebLogger("===青岛工行放款信息系统异常===prjId:" + prjId + ",capPayId:" + capPayId + ",ex:" + ex.getMessage()).setThrowable(ex).error(LogExceptionEnum.COMMON_CODE_0002);
		}
		return result;
	}

    @RequestMapping(value = "/toLoanResultPage.do", method = { RequestMethod.GET})
    public ModelAndView toLoanResultPage(HttpServletRequest request, HttpServletResponse response){
        ModelAndView view = new ModelAndView("capital/capPayFlow/loanResultInFlow");
		String prjId = request.getParameter("prjId");
		if(StringUtils.isEmpty(prjId)){
			throw new BaseException(BaseExceptionConstant.BASE_EXCEPTION_CODE_600,"项目主键为空！");
		}
		PrjBscInfoVO bscInfoVO = prjBscInfoService.selectById(Long.valueOf(prjId));
		Long fundRasInsId = null;
		if (bscInfoVO.getFundRasInsId() != null) {
			fundRasInsId = bscInfoVO.getFundRasInsId();
		} else {
			PrjBscExtDTO prjBscExtDTO = prjBscExtApiService.searchById(Long.valueOf(prjId));
			fundRasInsId = prjBscExtDTO.getInsId();
		}
		//查询三方支付表
		PrjPrdPaySchMQueryCondition pppsmqc = new PrjPrdPaySchMQueryCondition();
		pppsmqc.setPrjId(Long.valueOf(prjId));
		pppsmqc.setIsSqBiz(0);
		pppsmqc.setIsDel(0);
		pppsmqc.setPaySchTypCd(PrjPrdPaySchMConstant.PAY_SCH_TYP_CD_ZF);
		List<PrjPrdPaySchMVO> pppsmdtolist = prjPrdPaySchMService.searchList(pppsmqc);
		Long paySchId = null;
		String dsbrTamt = "";
		String sucRepyAmt = "";
		String lmtTrmStdt = "";
		String sucRepyDt = "";
		if (CollectionUtils.isNotEmpty(pppsmdtolist)) {
			paySchId = pppsmdtolist.get(0).getId();
        }
        cmm.mid.core.framework.dto.MessageDTO<PrjPaySchMDTO> queryFund = null;
		queryFund = cCBankApiService.applyFundCompensatoryResult(fundRasInsId, Long.valueOf(prjId), paySchId);
            BaseLogUtils.newLogger("applyFundCompensatoryResult.查询资方放款结果view={}",JSONObject.toJSONString(queryFund)).info();
            if (queryFund != null && queryFund.getData() != null) {
                PrjPaySchMDTO prjPaySchMDTO = queryFund.getData();
                if (prjPaySchMDTO.getDsbrTamt() != null) {
					dsbrTamt = String.valueOf(DecimalUtils.convertFenToYuan(prjPaySchMDTO.getDsbrTamt()));
				}
				if (prjPaySchMDTO.getSucRepyAmt() != null) {
					sucRepyAmt = String.valueOf(DecimalUtils.convertFenToYuan(prjPaySchMDTO.getSucRepyAmt()));
				}
				if (prjPaySchMDTO.getLmtTrmStdt() != null) {
					lmtTrmStdt = DateUtils.formatDateToString(prjPaySchMDTO.getLmtTrmStdt(), DateUtils.YYYY_MM_DD);
				}
				if (prjPaySchMDTO.getSucRepyDt() != null) {
					sucRepyDt = DateUtils.formatDateToString(prjPaySchMDTO.getSucRepyDt(), DateUtils.YYYY_MM_DD);
				}
            }

        view.addObject("dsbrTamt",dsbrTamt);
        view.addObject("sucRepyAmt",sucRepyAmt);
		view.addObject("lmtTrmStdt",lmtTrmStdt);
		view.addObject("sucRepyDt",sucRepyDt);
        BaseLogUtils.newLogger("toLoanResultPage.跳转到资方放款结果页签view={}",JSONObject.toJSONString(view)).info();
        return view;
    }

	@RequestMapping(value = "/toAccInsCfgPage.do", method = { RequestMethod.GET})
	public ModelAndView toAccInsCfgPage(HttpServletRequest request, HttpServletResponse response){
		ModelAndView view = new ModelAndView("capital/capPayFlow/accInsCfgInFlow");
		String prjId = request.getParameter("prjId");
		String isShowSaveBtn = request.getParameter("isShowSaveBtn");
		String isAllowPay = request.getParameter("isAllowPay");
		if(StringUtils.isEmpty(prjId)){
			throw new BaseException(BaseExceptionConstant.BASE_EXCEPTION_CODE_600,"项目主键为空！");
		}
		PrjBscInfoVO prjBscInfoVO = prjBscInfoService.selectById(Long.valueOf(prjId));
		if(null == prjBscInfoVO){
			throw new BaseException(BaseExceptionConstant.BASE_EXCEPTION_CODE_600,"未查询到项目信息！");
		}

		CstBscInfoVO cstBscInfoVO = cstBscInfoService.selectDetailById(prjBscInfoVO.getCstId());
		BaseLogUtils.newLogger("查询建行对公业务客户信息，prjId:{},cstBscInfoVO：{}" ,prjBscInfoVO.getId(), JSONObject.toJSONString(cstBscInfoVO)).info();
		view.addObject("certTypCd",cstBscInfoVO.getCertTypCd());//证件类型
		view.addObject("certTypCdNm",cstBscInfoVO.getCertTypCdNm());//证件类型名称
		view.addObject("certNo",cstBscInfoVO.getCertNo());//证件号

		CstCorpTeamVO cstCorpTeamVO = cstBscInfoVO.getCstCorpBscInfoVO().getCstCorpTeamVO();
		BaseLogUtils.newLogger("查询建行对公业务法人客户信息，prjId:{},cstCorpTeamVO：{}" ,prjBscInfoVO.getId(), JSONObject.toJSONString(cstCorpTeamVO)).info();
		view.addObject("mNm",cstCorpTeamVO.getmNm());
		view.addObject("mCertNo",cstCorpTeamVO.getCertNo());

		PrjCstAccInfoQueryCondition condition = new PrjCstAccInfoQueryCondition();
		condition.setCstId(prjBscInfoVO.getCstId());
		condition.setPrjId(prjBscInfoVO.getId());
		condition.setInsCode(prjBscInfoVO.getInsCode());
		condition.setIsDel(0);
		List<PrjCstAccInfoVO> prjCstAccInfoVOS = prjCstAccInfoService.searchList(condition);
		BaseLogUtils.newLogger("根据prjId获取账户信息,prjId:{},prjCstAccInfoVOS:{}",prjBscInfoVO.getId(),JSON.toJSONString(prjCstAccInfoVOS)).info();
		if(CollectionUtils.isNotEmpty(prjCstAccInfoVOS)){
			PrjCstAccInfoVO vo = prjCstAccInfoVOS.get(0);
			view.addObject("cstAccInfoId", vo.getId()); // 项目客户账号信息主键
			view.addObject("bcCertTypCd",vo.getCertTypCd());//当证件为营业执照时，补充证件类型
			view.addObject("bcCertTypCdNm",vo.getCertTypCdNm());
			view.addObject("bcCertNo",vo.getCertNo());//补充证件号
			view.addObject("accTypCd",vo.getAccTypCd());//账户类型（对公，个人）
			view.addObject("accTypCdNm",vo.getAccTypCdNm());
			view.addObject("accNo",vo.getAccNo());//银行账号
		}

		view.addObject("fundRasInsId",prjBscInfoVO.getFundRasInsId());
		view.addObject("fundRasInsNm", prjBscInfoVO.getFundRasInsNm()); //机构名称
		view.addObject("insCode", prjBscInfoVO.getInsCode());//机构code
		view.addObject("cstId", prjBscInfoVO.getCstId()); // 客户ID
		view.addObject("prjId", prjBscInfoVO.getId()); // 项目ID
		view.addObject("cstNm", prjBscInfoVO.getCstNm()); // 客户名称
		view.addObject("isShowSaveBtn",isShowSaveBtn);//是否展示保存按钮
		if ("0".equals(isAllowPay)){
			view.addObject("isShowSaveBtn",0);
		}
		BaseLogUtils.newLogger("toAccInsCfgPage.跳转到银行信息采集页签view={}",JSONObject.toJSONString(view)).info();
		return view;
	}

	/**
	 * 放款流程客户绑卡
	 * @param request
	 * @param response
	 * @return
	 * @throws BaseException
	 */
	@RequestMapping(value = "/toCstBindPage.do", method = { RequestMethod.POST , RequestMethod.GET})
	public Object toCstBindPage(HttpServletRequest request, HttpServletResponse response) throws BaseException {
		String capPayId = request.getParameter("capPayId");
		BaseLogUtils.newWebLogger("===客户绑卡页面信息===capPayId:" + capPayId).info();
		if(StringUtils.isEmpty(capPayId)){
			throw new BaseException(BaseExceptionConstant.BASE_EXCEPTION_CODE_600, "付款id不能为空.");
		}
		ModelAndView view = new ModelAndView();
		try {
			CapPayInfoVO capPayInfoVO = this.capPayInfoService.selectById(Long.valueOf(capPayId));
			BaseLogUtils.newWebLogger("===客户绑卡页面信息查询付款信息End===capPayId:" + capPayId + ",capPayInfoVO:" + JSON.toJSONString(capPayInfoVO)).info();
			if (null == capPayInfoVO) {
				throw new BaseException(BaseExceptionConstant.BASE_EXCEPTION_CODE_600, "付款信息为空.");
			}
			Long prjId = capPayInfoVO.getPrjId();
			if (StringUtils.isEmpty(prjId)) {
				throw new BaseException(BaseExceptionConstant.BASE_EXCEPTION_CODE_600, "项目id为空.");
			}
			BaseLogUtils.newWebLogger("===客户绑卡页面信息查询项目信息Start===prjId:" + prjId).info();
			PrjBscInfoVO prjBscInfoVO = this.prjBscInfoService.selectById(prjId);
			BaseLogUtils.newWebLogger("===客户绑卡页面信息查询项目信息End===prjId:" + prjId + ",prjBscInfoVO:" + JSON.toJSONString(prjBscInfoVO)).info();
			if (null == prjBscInfoVO) {
				throw new BaseException(BaseExceptionConstant.BASE_EXCEPTION_CODE_600, "项目信息为空.");
			}
			Long cstId = prjBscInfoVO.getCstId();
			BaseLogUtils.newWebLogger("===客户绑卡页面信息查询客户信息Start===cstId:" + cstId).info();
			CstBscInfoVO cstBscInfoVO = this.cstBscInfoService.selectBy(cstId, prjBscInfoVO.getBuOrgCd());
			BaseLogUtils.newWebLogger("===客户绑卡页面信息查询客户信息End===cstId:" + cstId + ",cstBscInfoVO" + JSON.toJSONString(cstBscInfoVO)).info();
			// 查找资管机构模块配置
			SysInsTabCfgVO sysInsTabCfgVO = this.sysInsTabCfgService.selectByInsCode(prjBscInfoVO.getInsCode());
			BaseLogUtils.newLogger("===客户绑卡页面信息查询信息采集页===sysInsTabCfgVO:{}", JSONObject.toJSONString(sysInsTabCfgVO)).info();
			String insCode = prjBscInfoVO.getInsCode();
			switch (insCode) {
				case PrjBscInfoConstant.PRJ_INS_CODE_SYFL:
					if (null != sysInsTabCfgVO) {
						view.setViewName(sysInsTabCfgVO.getUrl());
					}
					this.viewOfPrjBscInfoPageForSYFL(request, view, prjBscInfoVO, cstBscInfoVO);
					break;
				default:
					break;
			}

		}catch (BaseException ex) {
			BaseLogUtils.newWebLogger("===客户绑卡页面信息异常===capPayId:" + capPayId + ",ex:" + ex.getMessage()).info();
		}catch (Exception ex) {
			BaseLogUtils.newWebLogger("===客户绑卡页面信息系统异常===capPayId:" + capPayId + ",ex:" + ex.getMessage()).setThrowable(ex).error(LogExceptionEnum.COMMON_CODE_0002);
		}
		return view;
	}

	private void viewOfPrjBscInfoPageForSYFL(HttpServletRequest request, ModelAndView view, PrjBscInfoVO prjBscInfoVO, CstBscInfoVO cstBscInfoVO) {
		PrjCstAccInfoQueryCondition prjCstAccInfoQC = new PrjCstAccInfoQueryCondition();
		prjCstAccInfoQC.setPrjId(prjBscInfoVO.getId());
		prjCstAccInfoQC.setIsDel(BaseConstant.IS_YESNO_NO);
		prjCstAccInfoQC.setInsCode(prjBscInfoVO.getInsCode());
		BaseLogUtils.newWebLogger("==根据prjId获取账户信息Start==prjId:" + prjBscInfoVO.getId()).info();
		List<PrjCstAccInfoVO> prjCstAccInfoVOS = this.prjCstAccInfoService.searchList(prjCstAccInfoQC);
		BaseLogUtils.newWebLogger("==根据prjId获取账户信息End==prjId:" + prjBscInfoVO.getId() + ",prjCstAccInfoVOS:" + JSON.toJSONString(prjCstAccInfoVOS)).info();
		PrjCstAccInfoVO vo = new PrjCstAccInfoVO();
		if(CollectionUtils.isNotEmpty(prjCstAccInfoVOS)){
			vo = prjCstAccInfoVOS.get(0);
		}
		Long cstId = cstBscInfoVO.getId();
		String cstTypCd = cstBscInfoVO.getCstTypCd();
		String indCd = cstBscInfoVO.getIndCd();

		String certTypCd = null;
		String certNo = null;
		String certValidSDt = null;
		String certValidEDt = null;
		String domicileProvince = null;
		String domicleCity = null;
		String domicleCounty = null;
		String idAddr = null;
		String stdIndCd = null;
		// 自然人
		Integer isSmallBus = null;
		Integer isSelfEmp = null;

		// 法人-公司名称
		String shtNm = null;
		String borrowerfeature = null;
		String holdSituationCd = null;

        String mp = vo.getMp();
        String cstNm = prjBscInfoVO.getCstNm();

		switch (cstTypCd) {
			case CustomerConstant.CST_TYP_CD_NP:
				// 自然人
				CstNpBscInfoVO cstNpBscInfoVO = cstBscInfoVO.getCstNpBscInfoVO();
				BaseLogUtils.newWebLogger("==三一金融查询自然人客户信息Start==cstNpBscInfoVO:" + JSON.toJSONString(cstNpBscInfoVO)).info();
				if (null != cstNpBscInfoVO) {
					certValidSDt = cstNpBscInfoVO.getCertValidSDt();
					certValidEDt = cstNpBscInfoVO.getCertValidEDt();
					domicileProvince = cstNpBscInfoVO.getDomicileProvince();
					domicleCity = cstNpBscInfoVO.getDomicleCity();
					domicleCounty = cstNpBscInfoVO.getDomicleCounty();
					idAddr = cstNpBscInfoVO.getIdAddr();
					stdIndCd = cstNpBscInfoVO.getStdIndCd();
					isSmallBus = cstNpBscInfoVO.getIsSmallBus();
					isSelfEmp = cstNpBscInfoVO.getIsSelfEmp();
					certNo = prjBscInfoVO.getCertNo();
					certTypCd = cstBscInfoVO.getCertTypCd();
				}
				break;
			case CustomerConstant.CST_TYP_CD_CORP:
				// 法人
				CstCorpBscInfoVO cstCorpBscInfoVO = cstBscInfoVO.getCstCorpBscInfoVO();
				BaseLogUtils.newWebLogger("==三一金融查询法人客户信息Start==cstCorpBscInfoVO:" + JSON.toJSONString(cstCorpBscInfoVO)).info();
				if (null != cstCorpBscInfoVO) {
					shtNm = cstCorpBscInfoVO.getShtNm();
					if (StringUtils.isEmpty(shtNm)) {
						shtNm = cstBscInfoVO.getCstNm();
					}
					borrowerfeature = cstCorpBscInfoVO.getBorrowerfeature();
					holdSituationCd = cstCorpBscInfoVO.getHoldSituationCd();
					stdIndCd = cstCorpBscInfoVO.getStdIndCd();
				}
				CstCorpTeamQueryCondition cstCorpTeamQC = new CstCorpTeamQueryCondition();
				cstCorpTeamQC.setCstId(cstId);
				cstCorpTeamQC.setIsDel(BaseConstant.IS_YESNO_NO);
				cstCorpTeamQC.setmTypCd(CustomerConstant.CST_CORP_TEAM_LOWER);
				cstCorpTeamQC.setSysCd(CurrentThreadContext.getCurrentSysCd());
				BaseLogUtils.newWebLogger("==三一金融查询法人客户信息Start==cstCorpTeamQC:" + JSON.toJSONString(cstCorpTeamQC)).info();
				List<CstCorpTeamVO> cstCorpTeamVOS = this.cstCorpTeamService.searchList(cstCorpTeamQC);
				BaseLogUtils.newWebLogger("==三一金融查询法人客户信息End==cstCorpTeamVOS:" + JSON.toJSONString(cstCorpTeamVOS)).info();
				for (CstCorpTeamVO cstCorpTeamVO : cstCorpTeamVOS) {
					if (StringUtils.isNotBlank(cstCorpTeamVO.getCertTypCd()) && CustomerConstant.CERT_TYP_CD_0.equals(cstCorpTeamVO.getCertTypCd())) {
						certTypCd = cstCorpTeamVO.getCertTypCd();
						if (StringUtils.isNotBlank(cstCorpTeamVO.getCertNo())) {
							certNo = cstCorpTeamVO.getCertNo();
						}
						certValidSDt = cstCorpTeamVO.getCertValidSDt();
						certValidEDt = cstCorpTeamVO.getCertValidEDt();
						domicileProvince = cstCorpTeamVO.getPostProvince();
						domicleCity = cstCorpTeamVO.getPostCity();
						domicleCounty = cstCorpTeamVO.getPostCounty();
						idAddr = cstCorpTeamVO.getHomeAddr();
						if (StringUtils.isBlank(mp)) {
							mp = cstCorpTeamVO.getMp1();
						}
						cstNm = cstCorpTeamVO.getmNm();
					}
				}
				// 控股情况
				List<SysDictionaryDTO> sysDictionaryDTOHoldSitu = this.sysDictionaryApiService.searchGroup(CurrentThreadContext.getFlServiceSysCd(), CurrentThreadContext.getCurrentOrgCd(), DictionaryConstant.CODE_GRP_CST_HOLD_SITU_CD);
				List<KeyValueVO> holdSituationCdList = new ArrayList();
				for (SysDictionaryDTO sysDictionaryDTO : sysDictionaryDTOHoldSitu) {
					KeyValueVO keyValue = new KeyValueVO();
					keyValue.setKey(sysDictionaryDTO.getCode());
					keyValue.setValue(sysDictionaryDTO.getCodeNm());
					holdSituationCdList.add(keyValue);
				}
				view.addObject("holdSituationCdList", holdSituationCdList);
				// 借款人特征
				List<SysDictionaryDTO> sysDictionaryDTOBorrFea = this.sysDictionaryApiService.searchGroup(CurrentThreadContext.getFlServiceSysCd(), CurrentThreadContext.getCurrentOrgCd(), DictionaryConstant.CODE_GRP_CST_BORR_FEAT_CD);
				List<KeyValueVO> borrowerfeatureList = new ArrayList();
				for (SysDictionaryDTO sysDictionaryDTO : sysDictionaryDTOBorrFea) {
					KeyValueVO keyValue = new KeyValueVO();
					keyValue.setKey(sysDictionaryDTO.getCode());
					keyValue.setValue(sysDictionaryDTO.getCodeNm());
					borrowerfeatureList.add(keyValue);
				}
				view.addObject("borrowerfeatureList", borrowerfeatureList);
				break;
		}


		//区域 省 市 县
		if (StringUtils.isNotEmpty(domicileProvince)) {
			BaseLogUtils.newWebLogger("getSyflPrjAccInfo.三一金融查询省信息Start:domicileProvince:" + domicileProvince).info();
			SysRegionVO sysRegionVO = this.sysRegionService.getRegionByRgnCd(domicileProvince);
			BaseLogUtils.newWebLogger("getSyflPrjAccInfo.三一金融查询省信息End:sysRegionVO:" + JSON.toJSONString(sysRegionVO)).info();
			if(null != sysRegionVO && StringUtils.isNotEmpty(sysRegionVO.getRgnNm())){
				view.addObject("domicileProvinceNm", sysRegionVO.getRgnNm());//省
			}
		}
		if (StringUtils.isNotEmpty(domicleCity)) {
			BaseLogUtils.newWebLogger("getSyflPrjAccInfo.三一金融查询市信息Start:domicleCity:" + domicleCity).info();
			SysRegionVO sysRegionVO = this.sysRegionService.getRegionByRgnCd(domicleCity);
			BaseLogUtils.newWebLogger("getSyflPrjAccInfo.三一金融查询市信息End:sysRegionVO:" + JSON.toJSONString(sysRegionVO)).info();
			if(null != sysRegionVO && StringUtils.isNotEmpty(sysRegionVO.getRgnNm())){
				view.addObject("domicleCityNm", sysRegionVO.getRgnNm());//市
			}
		}
		if (StringUtils.isNotEmpty(domicleCounty)) {
			BaseLogUtils.newWebLogger("getSyflPrjAccInfo.三一金融查询区县信息Start:domicleCounty:" + domicleCounty).info();
			SysRegionVO sysRegionVO = this.sysRegionService.getRegionByRgnCd(domicleCounty);
			BaseLogUtils.newWebLogger("getSyflPrjAccInfo.三一金融查询区县信息End:sysRegionVO:" + JSON.toJSONString(sysRegionVO)).info();
			if(null != sysRegionVO && StringUtils.isNotEmpty(sysRegionVO.getRgnNm())){
				view.addObject("domicleCountyNm", sysRegionVO.getRgnNm());//县
			}
		}
		view.addObject("cstTypCd", cstTypCd);// 证件类型
		view.addObject("certTypCd", certTypCd);// 证件类型
		view.addObject("certNo", certNo);//身份证号
		view.addObject("domicileProvince", domicileProvince);
		view.addObject("domicleCity", domicleCity);
		view.addObject("domicleCounty", domicleCounty);
		view.addObject("idAddr", idAddr);
		view.addObject("certValidSDt", certValidSDt);
		view.addObject("certValidEDt", certValidEDt);
		view.addObject("indCd", indCd);
		view.addObject("stdIndCd", stdIndCd);

		// 自然人-是否小微企业
		view.addObject("isSmallBus", isSmallBus);
		view.addObject("isSelfEmp", isSelfEmp);
		// 法人-公司名称
		// 法人-公司名称
		view.addObject("shtNm", shtNm);
		view.addObject("borrowerfeature", borrowerfeature);
		view.addObject("holdSituationCd", holdSituationCd);

		view.addObject("cstId", prjBscInfoVO.getCstId()); // 客户ID
		view.addObject("prjId", prjBscInfoVO.getId()); // 项目ID
		view.addObject("cstNm", cstNm); // 客户名称
		view.addObject("fundRasInsNm", prjBscInfoVO.getFundRasInsNm()); // 机构名称
		view.addObject("insCode", prjBscInfoVO.getInsCode());//机构code

		view.addObject("cstAccInfoId", vo.getId()); // 项目客户账号信息主键
		view.addObject("bkNm", vo.getBkNm()); // 银行名称
		view.addObject("bkNo", vo.getBkNo()); // 开户行号
		view.addObject("accNo", vo.getAccNo()); // 银行账号
		view.addObject("bkCd", vo.getBkCd()); // 银行代码
		view.addObject("mp", mp); // 手机号
		view.addObject("chkRstCd", StringUtils.isNotBlank(vo.getChkRstCd()) ? vo.getChkRstCd() : "0");// 四要素
		view.addObject("accResCd", StringUtils.isNotBlank(vo.getAccResCd()) ? vo.getAccResCd() : InsAccResEnum.FAILURE.code);// 绑卡

		// 行业列表
		List<SysDictionaryDTO> sysDictionaryDTOIndCd = this.sysDictionaryApiService.searchGroup(CurrentThreadContext.getFlServiceSysCd(), CurrentThreadContext.getCurrentOrgCd(), DictionaryConstant.CODE_GRP_IND_CD);
		List<KeyValueVO> indCdInfoList = new ArrayList();
		for (SysDictionaryDTO sysDictionaryDTO : sysDictionaryDTOIndCd) {
			KeyValueVO keyValue = new KeyValueVO();
			keyValue.setKey(sysDictionaryDTO.getCode());
			keyValue.setValue(sysDictionaryDTO.getCodeNm());
			indCdInfoList.add(keyValue);
		}
		view.addObject("indCdInfoList", indCdInfoList);
		// 子行业列表
		List<KeyValueVO> stdIndCdInfoList = new ArrayList();
		if (StringUtils.isNotBlank(indCd)) {
			List<SysDictionaryDTO> sysDictionaryDTOS = this.sysDictionaryApiService.searchChild(CurrentThreadContext.getFlServiceSysCd(), CurrentThreadContext.getCurrentOrgCd(), DictionaryConstant.CODE_GRP_CST_SID_IND_CD, indCd);
			for (SysDictionaryDTO sysDictionaryDTO : sysDictionaryDTOS) {
				KeyValueVO keyValue = new KeyValueVO();
				keyValue.setKey(sysDictionaryDTO.getCode());
				keyValue.setValue(sysDictionaryDTO.getCodeNm());
				stdIndCdInfoList.add(keyValue);
			}
		}
		view.addObject("stdIndCdInfoList", stdIndCdInfoList);

		SysCdMapDQueryCondition cdMapDQC = new SysCdMapDQueryCondition();
		cdMapDQC.setSysCd(WebBaseConstant.SYS_SYS_CD);
		cdMapDQC.setOrgCd(CurrentThreadContext.getCurrentOrgCd());
		cdMapDQC.setmTypCd("M1041");
		cdMapDQC.setTCode(PrjBscInfoConstant.PRJ_INS_CODE_SYFL);
		BaseLogUtils.newLogger("==查询还款银行信息Start==cdMapDQC:" + JSONObject.toJSONString(cdMapDQC)).info();
		List<SysCdMapDDTO> sysCdMapDList =  this.sysCdMapApiService.searchSysCdMapDWithTargetList(cdMapDQC);
		BaseLogUtils.newLogger("==查询还款银行信息End==sysCdMapDList:" + JSONObject.toJSONString(sysCdMapDList)).info();
		List<KeyValueVO> list =  new ArrayList<>();
		JSONObject singleQuotaMap = new JSONObject();
		if (CollectionUtils.isNotEmpty(sysCdMapDList)) {
			for(SysCdMapDDTO sysCdMapDDTO : sysCdMapDList) {
				KeyValueVO kv = new KeyValueVO();
				kv.setKey(sysCdMapDDTO.getSCode());
				kv.setValue(sysCdMapDDTO.getSCodeNm());
				list.add(kv);
				singleQuotaMap.put(sysCdMapDDTO.getSCode(), sysCdMapDDTO.getCodeAttr1()); // 单笔限额
			}
		}
		view.addObject("bankList",list);
		String singleQuota = "";
		if(StringUtils.isNotBlank(vo.getBkCd())){
			singleQuota = singleQuotaMap.getString(vo.getBkCd());
		}
		view.addObject("singleQuota", singleQuota);
		view.addObject("singleQuotaMap",singleQuotaMap);
		view.addObject("isCstBind", true);
		BaseLogUtils.newLogger("viewOfPrjBscInfoPageForSYSL,进入页面=" + JSONObject.toJSONString(view)).info();
	}

}

